diff options
author | John Cai <jcai@gitlab.com> | 2022-04-20 19:31:17 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2022-04-21 03:18:34 +0300 |
commit | 6f96233eb33adefc756f4be6906a6370ec84a8bd (patch) | |
tree | 58223216973e31c266fba8d086bd1de2c7232e16 /internal/gitaly/service | |
parent | 53768dae0bc6395d2b80438286723a912aa50921 (diff) |
Remove Maintenance routing feature flag
Since the maintenance routing feature flag has been running in
production without issue, we can now remove it.
Changelog: changed
Diffstat (limited to 'internal/gitaly/service')
8 files changed, 43 insertions, 226 deletions
diff --git a/internal/gitaly/service/ref/pack_refs_test.go b/internal/gitaly/service/ref/pack_refs_test.go index e6da2b733..c91db2de5 100644 --- a/internal/gitaly/service/ref/pack_refs_test.go +++ b/internal/gitaly/service/ref/pack_refs_test.go @@ -2,7 +2,6 @@ package ref import ( "bufio" - "context" "fmt" "os" "path/filepath" @@ -14,7 +13,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/git" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/git/localrepo" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -23,12 +21,8 @@ import ( func TestPackRefsSuccessfulRequest(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPackRefsSuccessfulRequest) -} - -func testPackRefsSuccessfulRequest(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repoProto, repoPath, client := setupRefService(ctx, t) packedRefs := linesInPackfile(t, repoPath) @@ -74,19 +68,10 @@ func linesInPackfile(t *testing.T, repoPath string) int { func TestPackRefs_invalidRequest(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPackRefsInvalidRequest) -} - -func testPackRefsInvalidRequest(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRefServiceWithoutRepo(t) - praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found` - if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) { - praefectErr = `routing repository maintenance: getting repository metadata: repository not found` - } - tests := []struct { repo *gitalypb.Repository err error @@ -109,7 +94,7 @@ func testPackRefsInvalidRequest(t *testing.T, ctx context.Context) { codes.NotFound, gitalyOrPraefect( fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path), - praefectErr, + `routing repository maintenance: getting repository metadata: repository not found`, ), ), }, diff --git a/internal/gitaly/service/repository/cleanup_test.go b/internal/gitaly/service/repository/cleanup_test.go index 50fc670ce..862ee0e5b 100644 --- a/internal/gitaly/service/repository/cleanup_test.go +++ b/internal/gitaly/service/repository/cleanup_test.go @@ -1,7 +1,6 @@ package repository import ( - "context" "fmt" "os" "path/filepath" @@ -11,7 +10,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -26,11 +24,8 @@ const ( // https://gitlab.com/gitlab-org/gitaly/issues/1750 func TestCleanupDeletesStaleWorktrees(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupDeletesStaleWorktrees) -} -func testCleanupDeletesStaleWorktrees(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) testCases := []struct { @@ -92,12 +87,8 @@ func testCleanupDeletesStaleWorktrees(t *testing.T, ctx context.Context) { func TestCleanupDeletesOrphanedWorktrees(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupDeletesOrphanedWorktrees) -} - -func testCleanupDeletesOrphanedWorktrees(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) worktreeCheckoutPath := filepath.Join(repoPath, worktreePrefix, "test-worktree") @@ -120,11 +111,8 @@ func testCleanupDeletesOrphanedWorktrees(t *testing.T, ctx context.Context) { // https://gitlab.com/gitlab-org/gitaly/issues/1750 func TestCleanupDisconnectedWorktrees(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupDisconnectedWorktrees) -} -func testCleanupDisconnectedWorktrees(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) const ( worktreeName = "test-worktree" worktreeAdminDir = "worktrees" @@ -165,19 +153,10 @@ func testCleanupDisconnectedWorktrees(t *testing.T, ctx context.Context) { func TestCleanup_invalidRequest(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupInvalidRequest) -} - -func testCleanupInvalidRequest(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) - praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"so/me/some.git" not found` - if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) { - praefectErr = `routing repository maintenance: getting repository metadata: repository not found` - } - for _, tc := range []struct { desc string in *gitalypb.Repository @@ -199,7 +178,7 @@ func testCleanupInvalidRequest(t *testing.T, ctx context.Context) { codes.NotFound, gitalyOrPraefect( fmt.Sprintf(`GetRepoPath: not a git repository: %q`, filepath.Join(cfg.Storages[0].Path, "so/me/some.git")), - praefectErr, + `routing repository maintenance: getting repository metadata: repository not found`, ), ), }, diff --git a/internal/gitaly/service/repository/commit_graph_test.go b/internal/gitaly/service/repository/commit_graph_test.go index b50f520dd..c55c64665 100644 --- a/internal/gitaly/service/repository/commit_graph_test.go +++ b/internal/gitaly/service/repository/commit_graph_test.go @@ -2,7 +2,6 @@ package repository import ( "bytes" - "context" "fmt" "os" "path/filepath" @@ -12,7 +11,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/git/stats" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" @@ -22,12 +20,8 @@ import ( func TestWriteCommitGraph_withExistingCommitGraphCreatedWithDefaults(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testWriteCommitGraphWithExistingCommitGraphCreatedWithDefaults) -} - -func testWriteCommitGraphWithExistingCommitGraphCreatedWithDefaults(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) commitGraphPath := filepath.Join(repoPath, stats.CommitGraphRelPath) @@ -64,12 +58,8 @@ func testWriteCommitGraphWithExistingCommitGraphCreatedWithDefaults(t *testing.T func TestWriteCommitGraph_withExistingCommitGraphCreatedWithSplit(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testWriteCommitGraphWithExistingCommitGraphCreatedWithSplit) -} - -func testWriteCommitGraphWithExistingCommitGraphCreatedWithSplit(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) commitGraphPath := filepath.Join(repoPath, stats.CommitGraphRelPath) @@ -106,12 +96,8 @@ func testWriteCommitGraphWithExistingCommitGraphCreatedWithSplit(t *testing.T, c func TestWriteCommitGraph(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testWriteCommitGraph) -} - -func testWriteCommitGraph(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) chainPath := filepath.Join(repoPath, stats.CommitGraphChainRelPath) @@ -174,12 +160,8 @@ func TestWriteCommitGraph_validationChecks(t *testing.T) { func TestUpdateCommitGraph(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testUpdateCommitGraph) -} - -func testUpdateCommitGraph(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) chainPath := filepath.Join(repoPath, stats.CommitGraphChainRelPath) diff --git a/internal/gitaly/service/repository/gc_test.go b/internal/gitaly/service/repository/gc_test.go index 3308110bd..14abe909d 100644 --- a/internal/gitaly/service/repository/gc_test.go +++ b/internal/gitaly/service/repository/gc_test.go @@ -1,7 +1,6 @@ package repository import ( - "context" "fmt" "os" "path/filepath" @@ -16,7 +15,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/git/stats" "gitlab.com/gitlab-org/gitaly/v14/internal/helper/text" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" @@ -32,12 +30,8 @@ var ( func TestGarbageCollectCommitGraph(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectCommitGraph) -} - -func testGarbageCollectCommitGraph(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) //nolint:staticcheck @@ -51,12 +45,8 @@ func testGarbageCollectCommitGraph(t *testing.T, ctx context.Context) { func TestGarbageCollectSuccess(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectSuccess) -} - -func testGarbageCollectSuccess(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) tests := []struct { @@ -108,12 +98,8 @@ func testGarbageCollectSuccess(t *testing.T, ctx context.Context) { func TestGarbageCollectWithPrune(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectWithPrune) -} - -func testGarbageCollectWithPrune(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) blobHashes := gittest.WriteBlobs(t, cfg, repoPath, 3) @@ -155,12 +141,8 @@ func testGarbageCollectWithPrune(t *testing.T, ctx context.Context) { func TestGarbageCollectLogStatistics(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectLogStatistics) -} - -func testGarbageCollectLogStatistics(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) logger, hook := test.NewNullLogger() _, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger)) @@ -173,12 +155,8 @@ func testGarbageCollectLogStatistics(t *testing.T, ctx context.Context) { func TestGarbageCollectDeletesRefsLocks(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesRefsLocks) -} - -func testGarbageCollectDeletesRefsLocks(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) req := &gitalypb.GarbageCollectRequest{Repository: repo} @@ -219,11 +197,8 @@ func testGarbageCollectDeletesRefsLocks(t *testing.T, ctx context.Context) { func TestGarbageCollectDeletesPackedRefsLock(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesPackedRefsLock) -} -func testGarbageCollectDeletesPackedRefsLock(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) testCases := []struct { @@ -290,12 +265,8 @@ func testGarbageCollectDeletesPackedRefsLock(t *testing.T, ctx context.Context) func TestGarbageCollectDeletesFileLocks(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesFileLocks) -} - -func testGarbageCollectDeletesFileLocks(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) req := &gitalypb.GarbageCollectRequest{Repository: repo} @@ -331,11 +302,8 @@ func testGarbageCollectDeletesFileLocks(t *testing.T, ctx context.Context) { func TestGarbageCollectDeletesPackedRefsNew(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesPackedRefsNew) -} -func testGarbageCollectDeletesPackedRefsNew(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) testCases := []struct { @@ -390,20 +358,11 @@ func testGarbageCollectDeletesPackedRefsNew(t *testing.T, ctx context.Context) { func TestGarbageCollectFailure(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectFailure) -} - -func testGarbageCollectFailure(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) storagePath := strings.TrimSuffix(repoPath, "/"+repo.RelativePath) - praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found` - if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) { - praefectErr = `routing repository maintenance: getting repository metadata: repository not found` - } - tests := []struct { repo *gitalypb.Repository err error @@ -422,7 +381,7 @@ func testGarbageCollectFailure(t *testing.T, ctx context.Context) { codes.NotFound, gitalyOrPraefect( fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, storagePath), - praefectErr, + `routing repository maintenance: getting repository metadata: repository not found`, ), ), }, @@ -439,12 +398,8 @@ func testGarbageCollectFailure(t *testing.T, ctx context.Context) { func TestCleanupInvalidKeepAroundRefs(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupInvalidKeepAroundRefs) -} - -func testCleanupInvalidKeepAroundRefs(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) // Make the directory, so we can create random reflike things in it @@ -538,12 +493,8 @@ func mustCreateFileWithTimes(t testing.TB, path string, mTime time.Time) { func TestGarbageCollectDeltaIslands(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeltaIslands) -} - -func testGarbageCollectDeltaIslands(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) gittest.TestDeltaIslands(t, cfg, repoPath, func() error { diff --git a/internal/gitaly/service/repository/midx_test.go b/internal/gitaly/service/repository/midx_test.go index d0bea2ca0..1dec37ebf 100644 --- a/internal/gitaly/service/repository/midx_test.go +++ b/internal/gitaly/service/repository/midx_test.go @@ -17,7 +17,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/v14/internal/helper/text" "gitlab.com/gitlab-org/gitaly/v14/internal/metadata" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver" "gitlab.com/gitlab-org/gitaly/v14/internal/transaction/txinfo" @@ -29,12 +28,8 @@ import ( func TestMidxWrite(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxWrite) -} - -func testMidxWrite(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) //nolint:staticcheck @@ -52,12 +47,8 @@ func testMidxWrite(t *testing.T, ctx context.Context) { func TestMidxRewrite(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRewrite) -} - -func testMidxRewrite(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) midxPath := filepath.Join(repoPath, MidxRelPath) @@ -84,12 +75,8 @@ func testMidxRewrite(t *testing.T, ctx context.Context) { func TestMidxRepack(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepack) -} - -func testMidxRepack(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) // add some pack files with different sizes @@ -128,12 +115,8 @@ func testMidxRepack(t *testing.T, ctx context.Context) { func TestMidxRepack_transactional(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepackTransactional) -} - -func testMidxRepackTransactional(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) txManager := transaction.NewTrackingManager() cfg, repo, repoPath, client := setupRepositoryService(ctx, t, testserver.WithTransactionManager(txManager)) @@ -162,11 +145,8 @@ func testMidxRepackTransactional(t *testing.T, ctx context.Context) { func TestMidxRepackExpire(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepackExpire) -} -func testMidxRepackExpire(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) for _, packsAdded := range []int{3, 5, 11, 20} { diff --git a/internal/gitaly/service/repository/optimize_test.go b/internal/gitaly/service/repository/optimize_test.go index 4c63c3972..13f5804da 100644 --- a/internal/gitaly/service/repository/optimize_test.go +++ b/internal/gitaly/service/repository/optimize_test.go @@ -2,7 +2,6 @@ package repository import ( "bytes" - "context" "fmt" "os" "path/filepath" @@ -14,7 +13,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/git" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/git/stats" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -45,12 +43,8 @@ func getNewestPackfileModtime(t *testing.T, repoPath string) time.Time { func TestOptimizeRepository(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testOptimizeRepository) -} - -func testOptimizeRepository(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repoProto, repoPath, client := setupRepositoryService(ctx, t) gittest.Exec(t, cfg, "-C", repoPath, "repack", "-A", "-b") @@ -163,19 +157,10 @@ func testOptimizeRepository(t *testing.T, ctx context.Context) { func TestOptimizeRepositoryValidation(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testOptimizeRepositoryValidation) -} - -func testOptimizeRepositoryValidation(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, _, client := setupRepositoryService(ctx, t) - praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"path/not/exist" not found` - if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) { - praefectErr = `routing repository maintenance: getting repository metadata: repository not found` - } - testCases := []struct { desc string repo *gitalypb.Repository @@ -198,7 +183,7 @@ func testOptimizeRepositoryValidation(t *testing.T, ctx context.Context) { codes.NotFound, gitalyOrPraefect( fmt.Sprintf(`GetRepoPath: not a git repository: "%s/path/not/exist"`, cfg.Storages[0].Path), - praefectErr, + `routing repository maintenance: getting repository metadata: repository not found`, ), ), }, diff --git a/internal/gitaly/service/repository/prune_unreachable_objects_test.go b/internal/gitaly/service/repository/prune_unreachable_objects_test.go index b02aa224e..3c1c1d640 100644 --- a/internal/gitaly/service/repository/prune_unreachable_objects_test.go +++ b/internal/gitaly/service/repository/prune_unreachable_objects_test.go @@ -1,7 +1,6 @@ package repository import ( - "context" "os" "path/filepath" "testing" @@ -11,19 +10,14 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/git" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/helper" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" ) func TestPruneUnreachableObjects(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPruneUnreachableObjects) -} - -func testPruneUnreachableObjects(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) setObjectTime := func(t *testing.T, repoPath string, objectID git.ObjectID, when time.Time) { diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go index 244e23077..4dcc1b263 100644 --- a/internal/gitaly/service/repository/repack_test.go +++ b/internal/gitaly/service/repository/repack_test.go @@ -1,7 +1,6 @@ package repository import ( - "context" "fmt" "path/filepath" "testing" @@ -13,7 +12,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/git/stats" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" @@ -23,12 +21,8 @@ import ( func TestRepackIncrementalSuccess(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalSuccess) -} - -func testRepackIncrementalSuccess(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) _, repo, repoPath, client := setupRepositoryService(ctx, t) packPath := filepath.Join(repoPath, "objects", "pack") @@ -54,12 +48,8 @@ func testRepackIncrementalSuccess(t *testing.T, ctx context.Context) { func TestRepackIncrementalCollectLogStatistics(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalCollectLogStatistics) -} - -func testRepackIncrementalCollectLogStatistics(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) logger, hook := test.NewNullLogger() _, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger)) @@ -72,12 +62,8 @@ func testRepackIncrementalCollectLogStatistics(t *testing.T, ctx context.Context func TestRepackLocal(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackLocal) -} - -func testRepackLocal(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) altObjectsDir := "./alt-objects" @@ -111,20 +97,14 @@ func testRepackLocal(t *testing.T, ctx context.Context) { require.Contains(t, string(packContents), repoCommit.String()) } +const praefectErr = `routing repository maintenance: getting repository metadata: repository not found` + func TestRepackIncrementalFailure(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalFailure) -} -func testRepackIncrementalFailure(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) - praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found` - if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) { - praefectErr = `routing repository maintenance: getting repository metadata: repository not found` - } - tests := []struct { repo *gitalypb.Repository err error @@ -169,11 +149,8 @@ func testRepackIncrementalFailure(t *testing.T, ctx context.Context) { func TestRepackFullSuccess(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullSuccess) -} -func testRepackFullSuccess(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) tests := []struct { @@ -228,12 +205,8 @@ func testRepackFullSuccess(t *testing.T, ctx context.Context) { func TestRepackFullCollectLogStatistics(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullCollectLogStatistics) -} - -func testRepackFullCollectLogStatistics(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) logger, hook := test.NewNullLogger() _, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger)) @@ -273,18 +246,10 @@ func doBitmapsContainHashCache(t *testing.T, bitmapPaths []string) { func TestRepackFullFailure(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullFailure) -} -func testRepackFullFailure(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRepositoryServiceWithoutRepo(t) - praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found` - if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) { - praefectErr = `routing repository maintenance: getting repository metadata: repository not found` - } - tests := []struct { desc string repo *gitalypb.Repository @@ -329,12 +294,8 @@ func testRepackFullFailure(t *testing.T, ctx context.Context) { func TestRepackFullDeltaIslands(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullDeltaIslands) -} - -func testRepackFullDeltaIslands(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, repo, repoPath, client := setupRepositoryService(ctx, t) gittest.TestDeltaIslands(t, cfg, repoPath, func() error { |