Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-14 10:30:05 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-15 09:54:36 +0300
commitf05487e997ff29ddc97fea13995c2d84df71f224 (patch)
tree82fe7329cb8818a00d9676e515783238844b68a5
parent0a4043b8a5069a1ee1059f586f69afccd730e471 (diff)
repository: Don't use seeded repository in GarbageCollect test
Stop using seeded repositories in one of the tests for the GarbageCollect RPC. While at it, parallelize the subtests. Together this significantly speeds up the test: Before: `✓ internal/gitaly/service/repository (2.578s)` After: `✓ internal/gitaly/service/repository (1.146s)`
-rw-r--r--internal/gitaly/service/repository/gc_test.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/gitaly/service/repository/gc_test.go b/internal/gitaly/service/repository/gc_test.go
index 28572124b..00a0e19e3 100644
--- a/internal/gitaly/service/repository/gc_test.go
+++ b/internal/gitaly/service/repository/gc_test.go
@@ -207,7 +207,7 @@ func TestGarbageCollectDeletesPackedRefsLock(t *testing.T) {
ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
- testCases := []struct {
+ for _, tc := range []struct {
desc string
createLock func(t *testing.T, lockfilePath string)
shouldExist bool
@@ -230,13 +230,16 @@ func TestGarbageCollectDeletesPackedRefsLock(t *testing.T) {
desc: "with a non-existing lock",
shouldExist: false,
},
- }
+ } {
+ tc := tc
- for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
+ t.Parallel()
+
+ repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
+
+ gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("main"))
+ gittest.Exec(t, cfg, "-C", repoPath, "pack-refs", "--all")
// Force the packed-refs file to have an old time to test that even
// in that case it doesn't get deleted