diff options
author | John Cai <jcai@gitlab.com> | 2020-05-05 19:15:54 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2020-05-05 19:15:54 +0300 |
commit | b79460ab5f52649dc011cd76afcd225100fd59d7 (patch) | |
tree | 93b618b076ad0ccb3ac62565eed07520496b77f1 /internal/testhelper | |
parent | d7c2459f387b34d6b6e650a8a99dddc70402dc23 (diff) | |
parent | 3db4b6e930db20dd383329a5f0d970fb0ebdc737 (diff) |
Merge branch 'jc-wait-for-nodes' into 'master'
Block in NewManager to wait for nodes to be up
Closes #2563
See merge request gitlab-org/gitaly!2134
Diffstat (limited to 'internal/testhelper')
-rw-r--r-- | internal/testhelper/testserver.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/testhelper/testserver.go b/internal/testhelper/testserver.go index efdf1dbe5..16531b22c 100644 --- a/internal/testhelper/testserver.go +++ b/internal/testhelper/testserver.go @@ -519,15 +519,19 @@ type HTTPSettings struct { } func NewServerWithHealth(t testing.TB, socketName string) (*grpc.Server, *health.Server) { + lis, err := net.Listen("unix", socketName) + require.NoError(t, err) + + return NewHealthServerWithListener(t, lis) +} + +func NewHealthServerWithListener(t testing.TB, listener net.Listener) (*grpc.Server, *health.Server) { srv := NewTestGrpcServer(t, nil, nil) healthSrvr := health.NewServer() healthpb.RegisterHealthServer(srv, healthSrvr) healthSrvr.SetServingStatus("", healthpb.HealthCheckResponse_SERVING) - lis, err := net.Listen("unix", socketName) - require.NoError(t, err) - - go srv.Serve(lis) + go srv.Serve(listener) return srv, healthSrvr } |