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:
authorPavlo Strokov <pstrokov@gitlab.com>2021-10-21 12:57:28 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-10-21 12:57:28 +0300
commit77238fa64baa8c05a41db9d51d68db4af70967bf (patch)
tree432f1d73aefd139e793be5fb4dcb0531dfdefdd7
parentdfbf06e817c6a14fecd0e3d3343857fed820735d (diff)
test: Check error returned by gRCP server
In the tests we start gRPC server to serve the requests without verifying if it was started successfully or not. If there was a problem we should log it as it may contain a useful info about the failure. The error won't be returned in case the server is stopped because of the Stop or Shutdown method called on it - the happy scenario.
-rw-r--r--internal/testhelper/testserver/gitaly.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go
index 91b14df5e..9bac530bb 100644
--- a/internal/testhelper/testserver/gitaly.go
+++ b/internal/testhelper/testserver/gitaly.go
@@ -11,6 +11,7 @@ import (
"github.com/pelletier/go-toml"
"github.com/sirupsen/logrus"
+ "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
gitalyauth "gitlab.com/gitlab-org/gitaly/v14/auth"
"gitlab.com/gitlab-org/gitaly/v14/client"
@@ -232,9 +233,11 @@ func runGitaly(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, regi
internalListener, err := net.Listen("unix", cfg.GitalyInternalSocketPath())
require.NoError(t, err)
- go internalServer.Serve(internalListener)
+ go func() {
+ assert.NoError(t, internalServer.Serve(internalListener), "failure to serve internal gRPC")
+ }()
- defer waitHealthy(t, cfg, "unix://"+internalListener.Addr().String())
+ waitHealthy(t, cfg, "unix://"+internalListener.Addr().String())
}
externalServer, err := serverFactory.CreateExternal(cfg.TLS.CertPath != "" && cfg.TLS.KeyPath != "")
@@ -264,7 +267,9 @@ func runGitaly(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, regi
addr = "unix://" + serverSocketPath
}
- go externalServer.Serve(listener)
+ go func() {
+ assert.NoError(t, externalServer.Serve(listener), "failure to serve external gRPC")
+ }()
waitHealthy(t, cfg, addr)