diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2020-12-10 11:10:22 +0300 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2020-12-14 17:40:26 +0300 |
commit | b6fb5eaa181dd0caf45131df3c7c278e393ca3a9 (patch) | |
tree | 375aa948e3a09d616bd2420e9273b231f86f2eb4 | |
parent | 8358ea3b15709e8631d9db4becb0ab2606e344b4 (diff) |
Tags tests: pass nested tags through hooks
Amend the test I added in 5896fdaf4 (UserCreateTag tests: test nested
annotated tags, 2020-12-08) to use the hook setup boilerplate like the
tests before it.
I should have added this to 5896fdaf4 (part of
gitlab-org/gitaly!2881), but I didn't because I ran into an issue in
some WIP code with these hooks that turned out to be trivial. See [1].
1. https://gitlab.com/gitlab-org/gitaly/-/merge_requests/2905#note_465020107
-rw-r--r-- | internal/gitaly/service/operations/tags_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go index 8429878d5..65f31242f 100644 --- a/internal/gitaly/service/operations/tags_test.go +++ b/internal/gitaly/service/operations/tags_test.go @@ -382,6 +382,12 @@ func TestSuccessfulUserCreateTagNestedTags(t *testing.T) { testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t) defer cleanupFn() + preReceiveHook, cleanup := writeAssertObjectTypePreReceiveHook(t) + defer cleanup() + + updateHook, cleanup := writeAssertObjectTypeUpdateHook(t) + defer cleanup() + testCases := []struct { desc string targetObject string @@ -407,6 +413,18 @@ func TestSuccessfulUserCreateTagNestedTags(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { + // We resolve down to commit/tree/blob, but + // we'll only ever push a "tag" here. + hookObjectType := "tag" + for hook, content := range map[string]string{ + "pre-receive": fmt.Sprintf("#!/bin/sh\n%s %s \"$@\"", preReceiveHook, hookObjectType), + "update": fmt.Sprintf("#!/bin/sh\n%s %s \"$@\"", updateHook, hookObjectType), + } { + hookCleanup, err := testhelper.WriteCustomHook(testRepoPath, hook, []byte(content)) + require.NoError(t, err) + defer hookCleanup() + } + targetObject := testCase.targetObject nestLevel := 10 for i := 0; i < nestLevel; i++ { |