diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-17 17:38:13 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-19 16:34:30 +0300 |
commit | 32f980d53e4942199e6704475307fe5939e5f0d9 (patch) | |
tree | 350b997bb3438c8ade4c24652a2b1c22f5ae044a | |
parent | d53eee7b2a6e841c698743ec8713d4e51d13e96b (diff) |
rubyserver: Convert to use `testhelper.NewTestRepo()`
We're about to move the test storage into the global temporary test
directory, which will make use of `testhelper.TestRepository()` not work
anymore. This commit thus refactors `internal/gitaly/rubyserver` to use
`testhelper.NewTestRepo()` instead.
-rw-r--r-- | internal/gitaly/rubyserver/proxy_test.go | 9 | ||||
-rw-r--r-- | internal/gitaly/rubyserver/rubyserver_test.go | 3 | ||||
-rw-r--r-- | internal/gitaly/rubyserver/testhelper_test.go | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/internal/gitaly/rubyserver/proxy_test.go b/internal/gitaly/rubyserver/proxy_test.go index 6076a7ad0..d21b006ca 100644 --- a/internal/gitaly/rubyserver/proxy_test.go +++ b/internal/gitaly/rubyserver/proxy_test.go @@ -16,6 +16,9 @@ func TestSetHeadersBlocksUnknownMetadata(t *testing.T) { otherValue := "test-value" inCtx := metadata.NewIncomingContext(ctx, metadata.Pairs(otherKey, otherValue)) + testRepo, _, cleanup := testhelper.NewTestRepo(t) + defer cleanup() + outCtx, err := SetHeaders(inCtx, testhelper.DefaultLocator(), testRepo) require.NoError(t, err) @@ -34,6 +37,9 @@ func TestSetHeadersPreservesAllowlistedMetadata(t *testing.T) { value := "test-value" inCtx := metadata.NewIncomingContext(ctx, metadata.Pairs(key, value)) + testRepo, _, cleanup := testhelper.NewTestRepo(t) + defer cleanup() + outCtx, err := SetHeaders(inCtx, testhelper.DefaultLocator(), testRepo) require.NoError(t, err) @@ -51,6 +57,9 @@ func TestRubyFeatureHeaders(t *testing.T) { value := "true" inCtx := metadata.NewIncomingContext(ctx, metadata.Pairs(key, value)) + testRepo, _, cleanup := testhelper.NewTestRepo(t) + defer cleanup() + outCtx, err := SetHeaders(inCtx, testhelper.DefaultLocator(), testRepo) require.NoError(t, err) diff --git a/internal/gitaly/rubyserver/rubyserver_test.go b/internal/gitaly/rubyserver/rubyserver_test.go index c0a3a5553..f1635b5df 100644 --- a/internal/gitaly/rubyserver/rubyserver_test.go +++ b/internal/gitaly/rubyserver/rubyserver_test.go @@ -28,6 +28,9 @@ func TestSetHeaders(t *testing.T) { locator := testhelper.DefaultLocator() + testRepo, _, cleanup := testhelper.NewTestRepo(t) + defer cleanup() + testCases := []struct { desc string repo *gitalypb.Repository diff --git a/internal/gitaly/rubyserver/testhelper_test.go b/internal/gitaly/rubyserver/testhelper_test.go index bdd36f0eb..304f73e0d 100644 --- a/internal/gitaly/rubyserver/testhelper_test.go +++ b/internal/gitaly/rubyserver/testhelper_test.go @@ -5,11 +5,6 @@ import ( "testing" "gitlab.com/gitlab-org/gitaly/internal/testhelper" - "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" -) - -var ( - testRepo *gitalypb.Repository ) func TestMain(m *testing.M) { @@ -21,7 +16,6 @@ func testMain(m *testing.M) int { cleanup := testhelper.Configure() defer cleanup() - testRepo = testhelper.TestRepository() return m.Run() } |