diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2022-02-17 00:41:45 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2022-02-17 00:41:45 +0300 |
commit | 4c0d2a2c5127ba44ba5052a370c02184146a5155 (patch) | |
tree | 30447104affda6dae0c73a560cf35f34ed4a47d5 /internal | |
parent | ae8fbc5bf6725e6fa5b5a9dec6e4ac5016ec3c6c (diff) | |
parent | d3f469b09283260e388719673653599788dc1d56 (diff) |
Merge branch 'acceptance_tests' into 'master'
Replacing defer with testhelpers.Close() part 1
See merge request gitlab-org/gitlab-pages!689
Diffstat (limited to 'internal')
-rw-r--r-- | internal/testhelpers/testhelpers.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/testhelpers/testhelpers.go b/internal/testhelpers/testhelpers.go index 11bf7e65..2f708743 100644 --- a/internal/testhelpers/testhelpers.go +++ b/internal/testhelpers/testhelpers.go @@ -95,3 +95,13 @@ func PerformRequest(t *testing.T, handler http.Handler, r *http.Request) (int, s return res.StatusCode, string(b) } + +// Close will call the close function on a closer as part +// of the t.Cleanup function. +func Close(t *testing.T, c io.Closer) { + t.Helper() + + t.Cleanup(func() { + require.NoError(t, c.Close()) + }) +} |