diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-07-21 09:37:18 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-07-21 09:37:18 +0300 |
commit | d3caef18a88838486d64a427b00c40ac70f5c378 (patch) | |
tree | c5b4f577ed76b486455d0a99bad226ae45c3bd1c | |
parent | e80120e6b0dcde7f47b04002736fb8785494748e (diff) | |
parent | beb98d66c8dba648262b2da60a95954e3657a913 (diff) |
Merge branch 'pks-smarthttp-mock-race' into 'master'
Fix service registration after start
See merge request gitlab-org/gitaly!2398
-rw-r--r-- | internal/praefect/server_test.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go index f70e481fa..f97bf0409 100644 --- a/internal/praefect/server_test.go +++ b/internal/praefect/server_test.go @@ -38,6 +38,7 @@ import ( "gitlab.com/gitlab-org/gitaly/internal/version" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc" + "google.golang.org/grpc/health" "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/reflection" ) @@ -743,12 +744,20 @@ func (m *mockSmartHTTP) Called(method string) int { func newGrpcServer(t *testing.T, srv gitalypb.SmartHTTPServiceServer) (string, *grpc.Server) { socketPath := testhelper.GetTemporaryGitalySocketFileName() - grpcSrv, _ := testhelper.NewServerWithHealth(t, socketPath) + listener, err := net.Listen("unix", socketPath) + require.NoError(t, err) + + grpcServer := testhelper.NewTestGrpcServer(t, nil, nil) + + healthSrvr := health.NewServer() + grpc_health_v1.RegisterHealthServer(grpcServer, healthSrvr) + healthSrvr.SetServingStatus("", grpc_health_v1.HealthCheckResponse_SERVING) + gitalypb.RegisterSmartHTTPServiceServer(grpcServer, srv) + reflection.Register(grpcServer) - gitalypb.RegisterSmartHTTPServiceServer(grpcSrv, srv) - reflection.Register(grpcSrv) + go grpcServer.Serve(listener) - return socketPath, grpcSrv + return socketPath, grpcServer } func TestProxyWrites(t *testing.T) { |