diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2020-12-18 23:35:28 +0300 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2020-12-18 23:38:36 +0300 |
commit | cf9efae8603490980f1cf15c288659955d2120fe (patch) | |
tree | ab00f4416c35f6253996434df4925f0d2cd6ded2 | |
parent | 57b6a2fa32f530726a7a9621c680648b1f2aeb60 (diff) |
UserDeleteTag tests: use testhelper.MayFailRunCommand()avar/add-testhelper-mayfailruncommand
As noted in the commit that introduced the MayFailRunCommand()
function a couple of commits back it's useful for these cases where we
might die in the middle of N number of tests, so we'd like the tag
deleted for the next test. Otherwise failures would bleed across
tests.
-rw-r--r-- | internal/gitaly/service/operations/tags_test.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go index e39618c4e..d90d42d76 100644 --- a/internal/gitaly/service/operations/tags_test.go +++ b/internal/gitaly/service/operations/tags_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io/ioutil" - "os/exec" "path/filepath" "testing" @@ -38,7 +37,7 @@ func testSuccessfulUserDeleteTagRequest(t *testing.T, ctx context.Context) { tagNameInput := "to-be-deleted-soon-tag" - defer exec.Command(config.Config.Git.BinPath, "-C", testRepoPath, "tag", "-d", tagNameInput).Run() + defer testhelper.MayFailRunCommand(t, nil, "git", "-C", testRepoPath, "tag", "-d", tagNameInput) testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "tag", tagNameInput) @@ -73,7 +72,6 @@ func testSuccessfulGitHooksForUserDeleteTagRequest(t *testing.T, ctx context.Con defer cleanupFn() tagNameInput := "to-be-déleted-soon-tag" - defer exec.Command(config.Config.Git.BinPath, "-C", testRepoPath, "tag", "-d", tagNameInput).Run() request := &gitalypb.UserDeleteTagRequest{ Repository: testRepo, @@ -84,6 +82,7 @@ func testSuccessfulGitHooksForUserDeleteTagRequest(t *testing.T, ctx context.Con for _, hookName := range GitlabHooks { t.Run(hookName, func(t *testing.T) { testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "tag", tagNameInput) + defer testhelper.MayFailRunCommand(t, nil, "git", "-C", testRepoPath, "tag", "-d", tagNameInput) hookOutputTempPath, cleanup := testhelper.WriteEnvToCustomHook(t, testRepoPath, hookName) defer cleanup() @@ -523,7 +522,7 @@ func testUserDeleteTagsuccessfulDeletionOfPrefixedTag(t *testing.T, ctx context. for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "tag", testCase.tagNameInput, testCase.tagCommit) - defer exec.Command(config.Config.Git.BinPath, "-C", testRepoPath, "tag", "-d", testCase.tagNameInput).Run() + defer testhelper.MayFailRunCommand(t, nil, "git", "-C", testRepoPath, "tag", "-d", testCase.tagNameInput) request := &gitalypb.UserDeleteTagRequest{ Repository: testRepo, |