diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2021-03-17 21:18:42 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2021-03-17 21:23:07 +0300 |
commit | ee41d0dfb7b02a19f5926bfe24dbad1df417a29e (patch) | |
tree | 130f2777342645018f3f6b797ee0083d65910889 /internal/gitlabnet/discover/client_test.go | |
parent | 4b40a2cb8c71a5b490cad4c8e1ad2dc0e9b39548 (diff) | |
download | gitlab-shell-ee41d0dfb7b02a19f5926bfe24dbad1df417a29e.tar.gz |
Replace cleanup functions with t.Cleanup
In this case we don't need to propagate cleanup
function. It simplifies the code.
Diffstat (limited to 'internal/gitlabnet/discover/client_test.go')
-rw-r--r-- | internal/gitlabnet/discover/client_test.go | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/internal/gitlabnet/discover/client_test.go b/internal/gitlabnet/discover/client_test.go index d1b5039..ef35053 100644 --- a/internal/gitlabnet/discover/client_test.go +++ b/internal/gitlabnet/discover/client_test.go @@ -57,8 +57,7 @@ func init() { } func TestGetByKeyId(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) params := url.Values{} params.Add("key_id", "1") @@ -68,8 +67,7 @@ func TestGetByKeyId(t *testing.T) { } func TestGetByUsername(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) params := url.Values{} params.Add("username", "jane-doe") @@ -79,8 +77,7 @@ func TestGetByUsername(t *testing.T) { } func TestMissingUser(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) params := url.Values{} params.Add("username", "missing") @@ -90,8 +87,7 @@ func TestMissingUser(t *testing.T) { } func TestErrorResponses(t *testing.T) { - client, cleanup := setup(t) - defer cleanup() + client := setup(t) testCases := []struct { desc string @@ -127,11 +123,11 @@ func TestErrorResponses(t *testing.T) { } } -func setup(t *testing.T) (*Client, func()) { - url, cleanup := testserver.StartSocketHttpServer(t, requests) +func setup(t *testing.T) *Client { + url := testserver.StartSocketHttpServer(t, requests) client, err := NewClient(&config.Config{GitlabUrl: url}) require.NoError(t, err) - return client, cleanup + return client } |