summaryrefslogtreecommitdiff
path: root/internal/command/uploadarchive/gitalycall_test.go
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2021-05-05 16:00:35 +0100
committerNick Thomas <nick@gitlab.com>2021-05-05 17:07:23 +0100
commitd79d4777a88fcbf8f44771df76c4a6f1d3baa58b (patch)
treea62dc12af04fe38c0bd78d8247ffa3ccf1d7ad8e /internal/command/uploadarchive/gitalycall_test.go
parent584643e0e10e0cbeee4f8366b5e50656dfee9ea4 (diff)
downloadgitlab-shell-d79d4777a88fcbf8f44771df76c4a6f1d3baa58b.tar.gz
Respect parent context for Gitaly calls
Without these changes, Gitaly calls would not be linked to a parent context. This means that they would have an unassociated correlationID, and Gitaly RPC calls would not be cancel()ed by parent context cancellation. Changelog: fixed
Diffstat (limited to 'internal/command/uploadarchive/gitalycall_test.go')
-rw-r--r--internal/command/uploadarchive/gitalycall_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/command/uploadarchive/gitalycall_test.go b/internal/command/uploadarchive/gitalycall_test.go
index 03223e9..b89b749 100644
--- a/internal/command/uploadarchive/gitalycall_test.go
+++ b/internal/command/uploadarchive/gitalycall_test.go
@@ -6,8 +6,8 @@ import (
"testing"
"github.com/sirupsen/logrus"
-
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/labkit/correlation"
"gitlab.com/gitlab-org/gitlab-shell/client/testserver"
"gitlab.com/gitlab-org/gitlab-shell/internal/command/commandargs"
@@ -36,8 +36,9 @@ func TestUploadPack(t *testing.T) {
}
hook := testhelper.SetupLogger()
+ ctx := correlation.ContextWithCorrelation(context.Background(), "a-correlation-id")
- err := cmd.Execute(context.Background())
+ err := cmd.Execute(ctx)
require.NoError(t, err)
require.Equal(t, "UploadArchive: "+repo, output.String())
@@ -50,4 +51,5 @@ func TestUploadPack(t *testing.T) {
require.Contains(t, entries[1].Message, "command=git-upload-archive")
require.Contains(t, entries[1].Message, "gl_key_type=key")
require.Contains(t, entries[1].Message, "gl_key_id=123")
+ require.Contains(t, entries[1].Message, "correlation_id=a-correlation-id")
}