summaryrefslogtreecommitdiff
path: root/internal/gitlabnet/accessverifier/client_test.go
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2021-03-17 18:53:54 +0000
committerNick Thomas <nick@gitlab.com>2021-03-17 18:53:54 +0000
commit88f94337bb87c0cc51f6badf7a4ff1826f25efaa (patch)
tree130f2777342645018f3f6b797ee0083d65910889 /internal/gitlabnet/accessverifier/client_test.go
parent4b40a2cb8c71a5b490cad4c8e1ad2dc0e9b39548 (diff)
parentee41d0dfb7b02a19f5926bfe24dbad1df417a29e (diff)
downloadgitlab-shell-88f94337bb87c0cc51f6badf7a4ff1826f25efaa.tar.gz
Merge branch 'id-refactor-cleanup' into 'main'
Replace cleanup functions with t.Cleanup See merge request gitlab-org/gitlab-shell!460
Diffstat (limited to 'internal/gitlabnet/accessverifier/client_test.go')
-rw-r--r--internal/gitlabnet/accessverifier/client_test.go18
1 files changed, 7 insertions, 11 deletions
diff --git a/internal/gitlabnet/accessverifier/client_test.go b/internal/gitlabnet/accessverifier/client_test.go
index 3681968..ec566ac 100644
--- a/internal/gitlabnet/accessverifier/client_test.go
+++ b/internal/gitlabnet/accessverifier/client_test.go
@@ -53,8 +53,7 @@ func buildExpectedResponse(who string) *Response {
}
func TestSuccessfulResponses(t *testing.T) {
- client, cleanup := setup(t, "")
- defer cleanup()
+ client := setup(t, "")
testCases := []struct {
desc string
@@ -84,8 +83,7 @@ func TestSuccessfulResponses(t *testing.T) {
}
func TestGeoPushGetCustomAction(t *testing.T) {
- client, cleanup := setup(t, "responses/allowed_with_push_payload.json")
- defer cleanup()
+ client := setup(t, "responses/allowed_with_push_payload.json")
args := &commandargs.Shell{GitlabUsername: "custom"}
result, err := client.Verify(context.Background(), args, receivePackAction, repo)
@@ -107,8 +105,7 @@ func TestGeoPushGetCustomAction(t *testing.T) {
}
func TestGeoPullGetCustomAction(t *testing.T) {
- client, cleanup := setup(t, "responses/allowed_with_pull_payload.json")
- defer cleanup()
+ client := setup(t, "responses/allowed_with_pull_payload.json")
args := &commandargs.Shell{GitlabUsername: "custom"}
result, err := client.Verify(context.Background(), args, uploadPackAction, repo)
@@ -130,8 +127,7 @@ func TestGeoPullGetCustomAction(t *testing.T) {
}
func TestErrorResponses(t *testing.T) {
- client, cleanup := setup(t, "")
- defer cleanup()
+ client := setup(t, "")
testCases := []struct {
desc string
@@ -166,7 +162,7 @@ func TestErrorResponses(t *testing.T) {
}
}
-func setup(t *testing.T, allowedPayload string) (*Client, func()) {
+func setup(t *testing.T, allowedPayload string) *Client {
testDirCleanup, err := testhelper.PrepareTestRootDir()
require.NoError(t, err)
defer testDirCleanup()
@@ -227,10 +223,10 @@ func setup(t *testing.T, allowedPayload string) (*Client, func()) {
},
}
- url, cleanup := testserver.StartSocketHttpServer(t, requests)
+ url := testserver.StartSocketHttpServer(t, requests)
client, err := NewClient(&config.Config{GitlabUrl: url})
require.NoError(t, err)
- return client, cleanup
+ return client
}