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>2021-11-22 17:39:01 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-11-25 10:19:56 +0300
commita23759e31bab7a4f87cc669e1fa97b741d97bac4 (patch)
treeeb6e036504b5efce4d408271a9c06c3ee05525cc /internal/gitaly/service/operations
parentf87bc1e983d11788fdbce953dced45ec5554af23 (diff)
operations: Fix missing feature flag tests for UserMergeBranch
In commit c0e4ef911 (operations: Always return structured errors from Git2Go merges, 2021-09-21), we have removed the feature flag which switched over the "merge" subcommand of gitaly-git2go to use gob for serialization, and of course, this commit also removed the feature flag from the tests. While at it, the change was a bit too eager and also removed testing for the feature flag guarding structured errors in UserMergeBranch, and so the old code isn't currently tested at all. Reintroduce testing of the feature flag.
Diffstat (limited to 'internal/gitaly/service/operations')
-rw-r--r--internal/gitaly/service/operations/merge_test.go54
1 files changed, 27 insertions, 27 deletions
diff --git a/internal/gitaly/service/operations/merge_test.go b/internal/gitaly/service/operations/merge_test.go
index a8a99332c..8d834db9c 100644
--- a/internal/gitaly/service/operations/merge_test.go
+++ b/internal/gitaly/service/operations/merge_test.go
@@ -43,10 +43,10 @@ var (
func TestUserMergeBranch_successful(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchSuccessful)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchSuccessful(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -124,10 +124,10 @@ func TestUserMergeBranch_successful(t *testing.T) {
func TestUserMergeBranch_quarantine(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchQuarantine)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchQuarantine(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -174,10 +174,10 @@ func TestUserMergeBranch_quarantine(t *testing.T) {
func TestUserMergeBranch_stableMergeIDs(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchStableMergeIDs)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchStableMergeIDs(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -243,10 +243,10 @@ func TestUserMergeBranch_stableMergeIDs(t *testing.T) {
func TestUserMergeBranch_abort(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchAbort)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchAbort(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -308,10 +308,10 @@ func TestUserMergeBranch_abort(t *testing.T) {
func TestUserMergeBranch_concurrentUpdate(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchConcurrentUpdate)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchConcurrentUpdate(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -358,10 +358,10 @@ func TestUserMergeBranch_concurrentUpdate(t *testing.T) {
func TestUserMergeBranch_ambiguousReference(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchAmbiguousReference)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchAmbiguousReference(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -421,10 +421,10 @@ func TestUserMergeBranch_ambiguousReference(t *testing.T) {
func TestUserMergeBranch_failingHooks(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchFailingHooks)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchFailingHooks(t *testing.T, ctx context.Context) {
ctx, cfg, repo, repoPath, client := setupOperationsService(t, ctx)
gittest.Exec(t, cfg, "-C", repoPath, "branch", mergeBranchName, mergeBranchHeadBefore)
@@ -476,10 +476,10 @@ func TestUserMergeBranch_failingHooks(t *testing.T) {
func TestUserMergeBranch_conflict(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchConflict)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchConflict(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
const mergeIntoBranch = "mergeIntoBranch"
@@ -518,10 +518,10 @@ func TestUserMergeBranch_conflict(t *testing.T) {
func TestUserMergeBranch_allowed(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.UserMergeBranchAccessError).Run(t, testUserMergeBranchAllowed)
+}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
+func testUserMergeBranchAllowed(t *testing.T, ctx context.Context) {
mergeBranchHeadAfter := "ff0ac4dfa30d6b26fd14aa83a75650355270bf76"
for _, tc := range []struct {