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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-11-17 10:15:02 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-11-17 10:15:02 +0300
commitba9e4e7846361e9b83c0ac5a8039af69ee1fc506 (patch)
treeb07d436b47b00d9e79e0073d43abc8f602790ce1
parent92f9636c7b27c0ef977c0788d3db0297094b8c1a (diff)
gitaly/server: Fix race checking for expected log entries
The Gitaly server factory tests verify that various parts of the wiring for a newly created server work as expected. One part we try to verify is that the logger we pass is correctly being used. This is done by doing a health check RPC call and then checking that we got the expected log entry. This is prone to a race though: the log entry we expect to exist is created by our middleware and may thus be created after the client has already observed the result of the RPC call. As a result, it may happen that we do not yet have the log entry at the time of checking. Fix this race by gracefully stopping the server such that any ongoing requests were drained and thus fully processed.
-rw-r--r--internal/gitaly/server/server_factory_test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/gitaly/server/server_factory_test.go b/internal/gitaly/server/server_factory_test.go
index a9ad14696..682415550 100644
--- a/internal/gitaly/server/server_factory_test.go
+++ b/internal/gitaly/server/server_factory_test.go
@@ -135,6 +135,9 @@ func TestGitalyServerFactory(t *testing.T) {
checkHealth(t, sf, starter.TCP, "localhost:0")
+ // Stop all servers to drain any postprocessing done for RPC calls.
+ sf.GracefulStop()
+
var entry *logrus.Entry
for _, e := range hook.AllEntries() {
if e.Message == "finished unary call with code OK" {