diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-09 11:23:56 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-10 18:04:03 +0300 |
commit | 181f219b4e0134a00571d4bf7dc8f0ca4926b65b (patch) | |
tree | f43f0f75ede4c5f8fb3f15eff9c5fe69ce8bcde8 | |
parent | 434d8d73d9d088eaee413cd7f45832e016f9509a (diff) |
backup: Remove useless parameter for creating test repos
The `createRepo()` test helper function accepts a parameter which will
cause us to append a string to the repository's path. This parameter is
not required and only adds some confusion as to why it actually exists.
Remove the parameter.
-rw-r--r-- | internal/backup/backup_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/backup/backup_test.go b/internal/backup/backup_test.go index ad46e13f6..e36f463fd 100644 --- a/internal/backup/backup_test.go +++ b/internal/backup/backup_test.go @@ -339,12 +339,12 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config repoClient := gitalypb.NewRepositoryServiceClient(cc) - createRepo := func(t testing.TB, relativePath string) *gitalypb.Repository { + createRepo := func(t testing.TB) *gitalypb.Repository { t.Helper() repo := &gitalypb.Repository{ StorageName: "default", - RelativePath: gittest.NewRepositoryName(t, false) + relativePath, + RelativePath: gittest.NewRepositoryName(t, false), } for i := 0; true; i++ { @@ -382,7 +382,7 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config desc: "existing repo, without hooks", locators: []string{"legacy", "pointer"}, setup: func(t testing.TB) (*gitalypb.Repository, *git.Checksum) { - repo := createRepo(t, "existing") + repo := createRepo(t) require.NoError(t, os.MkdirAll(filepath.Join(path, repo.RelativePath), os.ModePerm)) bundlePath := filepath.Join(path, repo.RelativePath+".bundle") gittest.BundleTestRepo(t, cfg, "gitlab-test.git", bundlePath) @@ -395,7 +395,7 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config desc: "existing repo, with hooks", locators: []string{"legacy", "pointer"}, setup: func(t testing.TB) (*gitalypb.Repository, *git.Checksum) { - repo := createRepo(t, "existing_hooks") + repo := createRepo(t) bundlePath := filepath.Join(path, repo.RelativePath+".bundle") customHooksPath := filepath.Join(path, repo.RelativePath, "custom_hooks.tar") require.NoError(t, os.MkdirAll(filepath.Join(path, repo.RelativePath), os.ModePerm)) @@ -415,7 +415,7 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config desc: "missing bundle", locators: []string{"legacy", "pointer"}, setup: func(t testing.TB) (*gitalypb.Repository, *git.Checksum) { - repo := createRepo(t, "missing_bundle") + repo := createRepo(t) return repo, nil }, expectedErrAs: ErrSkipped, @@ -424,7 +424,7 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config desc: "missing bundle, always create", locators: []string{"legacy", "pointer"}, setup: func(t testing.TB) (*gitalypb.Repository, *git.Checksum) { - repo := createRepo(t, "missing_bundle_always_create") + repo := createRepo(t) return repo, new(git.Checksum) }, alwaysCreate: true, @@ -450,7 +450,7 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config locators: []string{"pointer"}, setup: func(t testing.TB) (*gitalypb.Repository, *git.Checksum) { const backupID = "abc123" - repo := createRepo(t, "incremental") + repo := createRepo(t) repoBackupPath := filepath.Join(path, repo.RelativePath) backupPath := filepath.Join(repoBackupPath, backupID) require.NoError(t, os.MkdirAll(backupPath, os.ModePerm)) @@ -469,10 +469,10 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config setup: func(t testing.TB) (*gitalypb.Repository, *git.Checksum) { const backupID = "abc123" - expected := createRepo(t, "expected") + expected := createRepo(t) expectedRepoPath := filepath.Join(cfg.Storages[0].Path, expected.RelativePath) - repo := createRepo(t, "incremental") + repo := createRepo(t) repoBackupPath := filepath.Join(path, repo.RelativePath) backupPath := filepath.Join(repoBackupPath, backupID) require.NoError(t, os.MkdirAll(backupPath, os.ModePerm)) |