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:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2020-12-10 11:22:15 +0300
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>2020-12-14 17:40:26 +0300
commitb858ea184bf6736434ac77c48bbc0d84bf34d4f0 (patch)
tree1d3e60ec759aa8d01876e27bea0d7e8cac8aa99c
parentb6fb5eaa181dd0caf45131df3c7c278e393ca3a9 (diff)
Tags tests: don't assign back to testCase reference in test loop
Fix a logic error of mine in b1f09d511 (UserCreateTag: fix internal error in tree/blob tag creation, 2020-12-04). It makes no sense to be assigning to our test data itself during the loop. As @toon points out in [1] the testCase variable is a reference. This didn't introduce a logic error in the test itself, since we're only using each item in the testCase array once, so it's OK for the test results if we mutate it as we go along. But let's change this to something more sensible anyway & change our transitory responseOk variable instead. This anti-pattern was itself copied from earlier code in 2ad030438 (Implement UserCreateTag RPC, 2017-09-26). A follow-up commit will fix that test case. 1. https://gitlab.com/gitlab-org/gitaly/-/merge_requests/2881#note_463363831
-rw-r--r--internal/gitaly/service/operations/tags_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go
index 65f31242f..1c8c794b2 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -355,7 +355,7 @@ func TestSuccessfulUserCreateTagRequestToNonCommit(t *testing.T) {
// Fake up *.Id for annotated tags
if len(testCase.expectedTag.Id) == 0 {
tagID := testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "rev-parse", inputTagName)
- testCase.expectedTag.Id = text.ChompBytes(tagID)
+ responseOk.Tag.Id = text.ChompBytes(tagID)
}
require.NoError(t, err)
require.Equal(t, responseOk, response)