As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 318bb14b authored by Patrick Bajao's avatar Patrick Bajao
Browse files

Set random correlation ID in uploadarchive test

This is to help debug race test failure so logs will have
correlation IDs that are unique and can easily be tracked.
parent b1898a2c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -53,7 +53,8 @@ func TestUploadArchive(t *testing.T) {
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output, In: input},
}
ctx := correlation.ContextWithCorrelation(context.Background(), "a-correlation-id")
correlationID := correlation.SafeRandomID()
ctx := correlation.ContextWithCorrelation(context.Background(), correlationID)
ctx = correlation.ContextWithClientName(ctx, "gitlab-shell-tests")
_, err := cmd.Execute(ctx)
Loading
Loading
@@ -75,7 +76,7 @@ func TestUploadArchive(t *testing.T) {
require.Equal(t, v, actual[0])
}
require.Empty(t, testServer.ReceivedMD["some-other-ff"])
require.Equal(t, testServer.ReceivedMD["x-gitlab-correlation-id"][0], "a-correlation-id")
require.Equal(t, testServer.ReceivedMD["x-gitlab-correlation-id"][0], correlationID)
})
}
}
Loading
Loading
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/labkit/correlation"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command"
Loading
Loading
@@ -21,7 +22,10 @@ func TestAllowedAccess(t *testing.T) {
cmd, _ := setup(t, "1", requests)
cmd.Config.GitalyClient.InitSidechannelRegistry(context.Background())
ctxWithLogData, err := cmd.Execute(context.Background())
correlationID := correlation.SafeRandomID()
ctx := correlation.ContextWithCorrelation(context.Background(), correlationID)
ctx = correlation.ContextWithClientName(ctx, "gitlab-shell-tests")
ctxWithLogData, err := cmd.Execute(ctx)
require.NoError(t, err)
data := ctxWithLogData.Value("logData").(command.LogData)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment