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>2021-04-15 11:49:43 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-04-19 10:23:54 +0300
commitceba1579a711103c56c30e510a07d61444191717 (patch)
tree56c29af97229b70427da1bf4bc80652c2f3e3f96 /internal/gitaly/hook/prereceive_test.go
parentf5c607b1ea9a59c35ae47b6b03bdf98ea183a379 (diff)
testhelper: Convert `WriteExecutable()` to use `t.Cleanup()`
Now that the minimum required Go version is 1.14, we have started to make use of `t.Cleanup()` to clean up temporary test state. Convert `WriteExecutable()` and some of its user to use it, too, instead of returning cleanup functions.
Diffstat (limited to 'internal/gitaly/hook/prereceive_test.go')
-rw-r--r--internal/gitaly/hook/prereceive_test.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/internal/gitaly/hook/prereceive_test.go b/internal/gitaly/hook/prereceive_test.go
index 1bcf28815..48537a048 100644
--- a/internal/gitaly/hook/prereceive_test.go
+++ b/internal/gitaly/hook/prereceive_test.go
@@ -165,8 +165,7 @@ func TestPrereceive_customHooks(t *testing.T) {
ctx, cleanup := testhelper.Context()
defer cleanup()
- cleanup = gittest.WriteCustomHook(t, repoPath, "pre-receive", []byte(tc.hook))
- defer cleanup()
+ gittest.WriteCustomHook(t, repoPath, "pre-receive", []byte(tc.hook))
var stdout, stderr bytes.Buffer
err = hookManager.PreReceiveHook(ctx, repo, tc.pushOptions, tc.env, strings.NewReader(tc.stdin), &stdout, &stderr)
@@ -307,8 +306,7 @@ func TestPrereceive_gitlab(t *testing.T) {
hookManager := NewManager(config.NewLocator(cfg), transaction.NewManager(cfg, backchannel.NewRegistry()), &gitlabAPI, cfg)
- cleanup = gittest.WriteCustomHook(t, repoPath, "pre-receive", []byte("#!/bin/sh\necho called\n"))
- defer cleanup()
+ gittest.WriteCustomHook(t, repoPath, "pre-receive", []byte("#!/bin/sh\necho called\n"))
var stdout, stderr bytes.Buffer
err = hookManager.PreReceiveHook(ctx, repo, nil, tc.env, strings.NewReader(tc.changes), &stdout, &stderr)