diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-04-23 19:41:08 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-04-23 19:41:08 +0300 |
commit | 63b05304d436cb24f2b231bfdb9d3d592f39b397 (patch) | |
tree | cb8fed0e1dbd59d06d1a39a0bcf41d30082f37ee | |
parent | b19cafa222fd7a999167d3f9f8562c2d74b62bfd (diff) |
Fix racy context access in a flaky testsmh-fix-racy-context-access
The `backchannel.ServerFactory` in the flaky test is checking a feature
flag at the same time from the context as the Praefect metadata is being
injected into few lines below. Fix the race by checkign the feature flag
status and using the result inside the ServerFactory instead of accessing
the context.
-rw-r--r-- | internal/gitaly/service/smarthttp/receive_pack_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go index 940605bbe..a4b03b798 100644 --- a/internal/gitaly/service/smarthttp/receive_pack_test.go +++ b/internal/gitaly/service/smarthttp/receive_pack_test.go @@ -586,9 +586,10 @@ func testPostReceiveWithReferenceTransactionHook(t *testing.T, ctx context.Conte go gitalyServer.Serve(internalListener) defer gitalyServer.Stop() + backchannelVotingEnabled := featureflag.IsEnabled(ctx, featureflag.BackchannelVoting) client := newMuxedSmartHTTPClient(t, ctx, "unix://"+gitalySocketPath, cfg.Auth.Token, func() backchannel.Server { srv := grpc.NewServer() - if featureflag.IsEnabled(ctx, featureflag.BackchannelVoting) { + if backchannelVotingEnabled { gitalypb.RegisterRefTransactionServer(srv, refTransactionServer) } |