From 63b05304d436cb24f2b231bfdb9d3d592f39b397 Mon Sep 17 00:00:00 2001 From: Sami Hiltunen Date: Fri, 23 Apr 2021 18:41:08 +0200 Subject: [PATCH] Fix racy context access in a flaky test 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. --- internal/gitaly/service/smarthttp/receive_pack_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go index 940605bbea7..a4b03b798dd 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) } -- GitLab