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-07-22 10:01:32 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-27 13:11:42 +0300
commit0fedeb41fda77a8024f923060b646648dbb753bb (patch)
tree36b037f3581266cb0b4dbdfa306a318434057963 /internal/gitaly/server/auth_test.go
parentc9f05efe6864f6d0c34d5ed51113c5884a2648a5 (diff)
operations: Introduce structured errors for UserCreateTagpks-user-create-tag-introduce-structured-errors
The UserCreateTag RPC has several conditions where it fails to create the tag, but still returns a successful response. That response may either contain a pre-receive error message indicating that updating the reference has failed because of one of multiple reasons, or it may indicate that the tag exists already. Returning successfully in error cases is a code smell, and we have started to convert all RPCs that do this to instead return structured errors. With these structured errors, we are able to keep up the semantics that failure to perform the action results in an error but keep the client's ability to special-case some specific errors. Convert UserCreateTag to do the same and return UserCreateTagErrors. This both gives us better visibility into what exactly is happening on the Gitaly side and fixes another case where we needlessly create replication jobs because of missing transactional votes. Changelog: fixed
Diffstat (limited to 'internal/gitaly/server/auth_test.go')
-rw-r--r--internal/gitaly/server/auth_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/gitaly/server/auth_test.go b/internal/gitaly/server/auth_test.go
index 5a128a8f9..464feecc5 100644
--- a/internal/gitaly/server/auth_test.go
+++ b/internal/gitaly/server/auth_test.go
@@ -28,6 +28,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service/setup"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitlab"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v15/internal/middleware/limithandler"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper/testcfg"
@@ -345,6 +346,10 @@ sleep %vs
for i := 0; i < 2; i++ {
i := i
go func() {
+ // We don't care about the feature flag, but it's required to satisfy our
+ // sanity checks in testing. So let's just explicitly enable it here.
+ ctx := featureflag.OutgoingCtxWithFeatureFlag(ctx, featureflag.UserCreateTagStructuredErrors, true)
+
_, err := client.UserCreateTag(ctx, &gitalypb.UserCreateTagRequest{
Repository: repo,
TagName: []byte(fmt.Sprintf("tag-name-%d", i)),