diff options
Diffstat (limited to 'internal/gitaly/service/operations/submodules_test.go')
-rw-r--r-- | internal/gitaly/service/operations/submodules_test.go | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/internal/gitaly/service/operations/submodules_test.go b/internal/gitaly/service/operations/submodules_test.go index e3de793b0..779d9ca4f 100644 --- a/internal/gitaly/service/operations/submodules_test.go +++ b/internal/gitaly/service/operations/submodules_test.go @@ -9,16 +9,16 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" "gitlab.com/gitlab-org/gitaly/internal/git/lstree" + "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" ) func TestSuccessfulUserUpdateSubmoduleRequest(t *testing.T) { - ctx, cancel := testhelper.Context() - defer cancel() - - testSuccessfulUserUpdateSubmoduleRequest(t, ctx) + testhelper.NewFeatureSets( + []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule}, + ).Run(t, testSuccessfulUserUpdateSubmoduleRequest) } func testSuccessfulUserUpdateSubmoduleRequest(t *testing.T, ctx context.Context) { @@ -86,6 +86,12 @@ func testSuccessfulUserUpdateSubmoduleRequest(t *testing.T, ctx context.Context) } func TestFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T) { + testhelper.NewFeatureSets( + []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule}, + ).Run(t, testFailedUserUpdateSubmoduleRequestDueToValidations) +} + +func testFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() @@ -200,7 +206,7 @@ func TestFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - ctx, cancel := testhelper.Context() + ctx, cancel := context.WithCancel(ctx) defer cancel() _, err := client.UserUpdateSubmodule(ctx, testCase.request) @@ -211,9 +217,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T) { } func TestFailedUserUpdateSubmoduleRequestDueToInvalidBranch(t *testing.T) { - ctx, cancel := testhelper.Context() - defer cancel() + testhelper.NewFeatureSets( + []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule}, + ).Run(t, testFailedUserUpdateSubmoduleRequestDueToInvalidBranch) +} +func testFailedUserUpdateSubmoduleRequestDueToInvalidBranch(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() @@ -238,9 +247,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToInvalidBranch(t *testing.T) { } func TestFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule(t *testing.T) { - ctx, cancel := testhelper.Context() - defer cancel() + testhelper.NewFeatureSets( + []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule}, + ).Run(t, testFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule) +} +func testFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() @@ -265,9 +277,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule(t *testing.T) { } func TestFailedUserUpdateSubmoduleRequestDueToSameReference(t *testing.T) { - ctx, cancel := testhelper.Context() - defer cancel() + testhelper.NewFeatureSets( + []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule}, + ).Run(t, testFailedUserUpdateSubmoduleRequestDueToSameReference) +} +func testFailedUserUpdateSubmoduleRequestDueToSameReference(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() @@ -295,9 +310,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToSameReference(t *testing.T) { } func TestFailedUserUpdateSubmoduleRequestDueToRepositoryEmpty(t *testing.T) { - ctx, cancel := testhelper.Context() - defer cancel() + testhelper.NewFeatureSets( + []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule}, + ).Run(t, testFailedUserUpdateSubmoduleRequestDueToRepositoryEmpty) +} +func testFailedUserUpdateSubmoduleRequestDueToRepositoryEmpty(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() |