diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-09 11:26:52 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-10 18:04:03 +0300 |
commit | 152eed395a273b99541257609664241296aef62e (patch) | |
tree | 533c239bd6c24b7e3831dd3c0de99cee3df3b3aa | |
parent | 181f219b4e0134a00571d4bf7dc8f0ca4926b65b (diff) |
backup: Generate random path for missing repo test
The test which verifies that restoring a nonexistent repository works as
expected is using a deterministic relative path for the nonexistent
repo. As a result, we cannot parallelize this test because otherwise
concurrent tests may race to access the same location.
Fix this by using a generated path.
-rw-r--r-- | internal/backup/backup_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/backup/backup_test.go b/internal/backup/backup_test.go index e36f463fd..1843999b8 100644 --- a/internal/backup/backup_test.go +++ b/internal/backup/backup_test.go @@ -436,8 +436,10 @@ func testManagerRestoreWithContext(t *testing.T, ctx context.Context, cfg config setup: func(t testing.TB) (*gitalypb.Repository, *git.Checksum) { repo := &gitalypb.Repository{ StorageName: "default", - RelativePath: "nonexistent", + RelativePath: gittest.NewRepositoryName(t, false), } + + require.NoError(t, os.MkdirAll(filepath.Dir(filepath.Join(path, repo.RelativePath)), os.ModePerm)) bundlePath := filepath.Join(path, repo.RelativePath+".bundle") gittest.BundleTestRepo(t, cfg, "gitlab-test.git", bundlePath) |