Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2021-02-24 15:10:05 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-02-24 15:23:08 +0300
commit3bebe661e9a51c8b6915834c91eae65c2a632b77 (patch)
tree11b381cf54b5f581a5c0b3a734514166c56a7ac3
parent9782b6c0a52d79f86be438e55a9d15ae8a172f98 (diff)
fix racy test TestCoordinator_grpcErrorHandling
TestCoordinator_grpcErrorHandling has a race where in the "primary error gets forwarded" error case. The mock server does acks a call as done before setting a flag indicating the node was called. This causes a race where the primary might return an error before the secondary calls have been recorded as having arrived. This causes the test to then flake as the primary error is returned and the assertions are done before the secondary calls have been recorded. This commit fixes the issue by recording the call as having arrived prior to marking decremeting the counter of the WorkGroup.
-rw-r--r--internal/praefect/coordinator_test.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index df6510e17..45f173999 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -1309,10 +1309,9 @@ func (s *mockOperationServer) UserCreateBranch(
// example the primary arrives quicker than the others and directly errors. This would cause
// stream cancellation, and if the secondaries didn't yet end up in UserCreateBranch, we
// wouldn't see the function call.
+ s.called = true
s.wg.Done()
s.wg.Wait()
-
- s.called = true
return &gitalypb.UserCreateBranchResponse{}, s.err
}