diff options
Diffstat (limited to 'internal/service/smarthttp/testhelper_test.go')
-rw-r--r-- | internal/service/smarthttp/testhelper_test.go | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/internal/service/smarthttp/testhelper_test.go b/internal/service/smarthttp/testhelper_test.go index ed5eff8d3..aa300b59f 100644 --- a/internal/service/smarthttp/testhelper_test.go +++ b/internal/service/smarthttp/testhelper_test.go @@ -1,10 +1,10 @@ package smarthttp import ( - "net" "os" "testing" + "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/hooks" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" @@ -28,21 +28,15 @@ func testMain(m *testing.M) int { return m.Run() } -func runSmartHTTPServer(t *testing.T) (*grpc.Server, string) { - server := testhelper.NewTestGrpcServer(t, nil, nil) +func runSmartHTTPServer(t *testing.T) (func(), string) { + srv := testhelper.NewServer(t, nil, nil) - serverSocketPath := testhelper.GetTemporaryGitalySocketFileName() - listener, err := net.Listen("unix", serverSocketPath) - if err != nil { - t.Fatal(err) - } - - gitalypb.RegisterSmartHTTPServiceServer(server, NewServer()) - reflection.Register(server) + gitalypb.RegisterSmartHTTPServiceServer(srv.GrpcServer(), NewServer()) + reflection.Register(srv.GrpcServer()) - go server.Serve(listener) + require.NoError(t, srv.Start()) - return server, "unix://" + serverSocketPath + return srv.Stop, "unix://" + srv.Socket() } func newSmartHTTPClient(t *testing.T, serverSocketPath string) (gitalypb.SmartHTTPServiceClient, *grpc.ClientConn) { |