Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2022-02-17 00:41:45 +0300
committerJaime Martinez <jmartinez@gitlab.com>2022-02-17 00:41:45 +0300
commit4c0d2a2c5127ba44ba5052a370c02184146a5155 (patch)
tree30447104affda6dae0c73a560cf35f34ed4a47d5 /internal
parentae8fbc5bf6725e6fa5b5a9dec6e4ac5016ec3c6c (diff)
parentd3f469b09283260e388719673653599788dc1d56 (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.go10
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())
+ })
+}