Skip to content

Fix wait group add order in test

Jaime Martinez requested to merge 800-fix-waitgroup-order into master

What does this MR do?

In Fix data race with lookup paths (!822 - merged) we introduced a new test TestResolveLookupPathsConcurrentNetRequests that does some concurrent requests using sync.WaitGroup. The order in which we call the goroutine and the wg.Add(1) matters in this case because there is a chance the goroutine will finish faster than adding a delta to the wait group as seen in https://gitlab.com/gitlab-org/gitlab-pages/-/jobs/2769712947.

This MR fixes the issue by making sure we call wg.Add before executing the goroutine.

Closes #800 (closed)

Edited by Jaime Martinez

Merge request reports