diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-17 18:11:56 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-19 16:35:56 +0300 |
commit | 4a09069c47bbb546299035c8570e6a5e7230ed75 (patch) | |
tree | 5cac019f8076638b5d3f42b59007e93dcd051b68 | |
parent | a90f372d8e277d28ad5eb96319553772e6b96369 (diff) |
smarthttp: 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/service/smarthttp`
to use `testhelper.NewTestRepo()` instead.
-rw-r--r-- | internal/gitaly/service/smarthttp/inforefs_test.go | 3 | ||||
-rw-r--r-- | internal/gitaly/service/smarthttp/upload_pack_test.go | 19 |
2 files changed, 12 insertions, 10 deletions
diff --git a/internal/gitaly/service/smarthttp/inforefs_test.go b/internal/gitaly/service/smarthttp/inforefs_test.go index a9ff321bf..e77d4f26c 100644 --- a/internal/gitaly/service/smarthttp/inforefs_test.go +++ b/internal/gitaly/service/smarthttp/inforefs_test.go @@ -54,7 +54,8 @@ func TestSuccessfulInfoRefsUploadWithPartialClone(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() - testRepo := testhelper.TestRepository() + testRepo, _, cleanup := testhelper.NewTestRepo(t) + defer cleanup() request := &gitalypb.InfoRefsRequest{ Repository: testRepo, diff --git a/internal/gitaly/service/smarthttp/upload_pack_test.go b/internal/gitaly/service/smarthttp/upload_pack_test.go index cdd2757fd..ebbc6d341 100644 --- a/internal/gitaly/service/smarthttp/upload_pack_test.go +++ b/internal/gitaly/service/smarthttp/upload_pack_test.go @@ -38,8 +38,8 @@ func TestSuccessfulUploadPackRequest(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() - testRepo := testhelper.TestRepository() - testRepoPath := filepath.Join(testhelper.GitlabTestStoragePath(), testRepo.RelativePath) + _, testRepoPath, cleanup := testhelper.NewTestRepo(t) + defer cleanup() storagePath := testhelper.GitlabTestStoragePath() remoteRepoRelativePath := "gitlab-test-remote" @@ -107,8 +107,8 @@ func TestUploadPackRequestWithGitConfigOptions(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() - testRepo := testhelper.TestRepository() - testRepoPath := filepath.Join(testhelper.GitlabTestStoragePath(), testRepo.RelativePath) + _, testRepoPath, cleanup := testhelper.NewTestRepo(t) + defer cleanup() storagePath := testhelper.GitlabTestStoragePath() ourRepoRelativePath := "gitlab-test-remote" @@ -173,8 +173,8 @@ func TestUploadPackRequestWithGitProtocol(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() - testRepo := testhelper.TestRepository() - testRepoPath := filepath.Join(testhelper.GitlabTestStoragePath(), testRepo.RelativePath) + _, testRepoPath, cleanup := testhelper.NewTestRepo(t) + defer cleanup() storagePath := testhelper.GitlabTestStoragePath() relativePath, err := filepath.Rel(storagePath, testRepoPath) @@ -218,7 +218,8 @@ func TestSuccessfulUploadPackDeepenRequest(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() - testRepo := testhelper.TestRepository() + testRepo, _, cleanup := testhelper.NewTestRepo(t) + defer cleanup() requestBody := &bytes.Buffer{} pktline.WriteString(requestBody, fmt.Sprintf("want e63f41fe459e62e1228fcef60d7189127aeba95a %s\n", clientCapabilities)) @@ -330,8 +331,8 @@ func TestUploadPackRequestForPartialCloneSuccess(t *testing.T) { ) defer stop() - testRepo := testhelper.TestRepository() - testRepoPath := filepath.Join(testhelper.GitlabTestStoragePath(), testRepo.RelativePath) + _, testRepoPath, cleanup := testhelper.NewTestRepo(t) + defer cleanup() storagePath := testhelper.GitlabTestStoragePath() remoteRepoRelativePath := "gitlab-test-remote" |