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>2023-12-05 13:34:10 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2023-12-05 13:34:10 +0300
commit2b15ebb84c8c3b2474a7a70d3cb341904516ff64 (patch)
tree5a5b8618c6d259be5d39666396e2fd599f4e31e1
parentd3f79c8f0c80f847174b55555642eb77e6c35811 (diff)
Consume stream to finish in flaky test
TestInterceptor/streaming_repository-scoped_call is flaky due to not consuming the gRPC stream to finish. The test server is recording the captured tags after calling the handler. This leads to a race where the test body may assert the tags while the server is storing them. Fix the race by consuming the stream to finish in the test. This way the interceptor capturing the tags runs to finish before the test asserts the result as the test has to wait for the status to be received first. While at it, simplify the test handler by removing the unnecessary response sending as it doesn't help with the synchronization.
-rw-r--r--internal/grpc/middleware/requestinfohandler/requestinfohandler_test.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/internal/grpc/middleware/requestinfohandler/requestinfohandler_test.go b/internal/grpc/middleware/requestinfohandler/requestinfohandler_test.go
index 38e40faeb..a51755430 100644
--- a/internal/grpc/middleware/requestinfohandler/requestinfohandler_test.go
+++ b/internal/grpc/middleware/requestinfohandler/requestinfohandler_test.go
@@ -599,7 +599,7 @@ func TestInterceptors(t *testing.T) {
}))
_, err = stream.Recv()
- require.NoError(t, err)
+ require.Equal(t, err, io.EOF)
},
expectedInfo: &RequestInfo{
clientName: "unknown",
@@ -744,13 +744,6 @@ func (s *mockServer) FetchIntoObjectPool(ctx context.Context, _ *gitalypb.FetchI
}
func (s *mockServer) CreateBundleFromRefList(stream gitalypb.RepositoryService_CreateBundleFromRefListServer) error {
- if _, err := stream.Recv(); err != nil {
- return err
- }
-
- if err := stream.Send(&gitalypb.CreateBundleFromRefListResponse{}); err != nil {
- return err
- }
-
- return nil
+ _, err := stream.Recv()
+ return err
}