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>2021-08-25 09:01:26 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-08-25 10:29:46 +0300
commit135c1398b2531103d3aeebaee66f19ef799f1f52 (patch)
tree2a322afad0c37c41afc870305c94f843ad372fc9 /internal/testhelpers
parentf0bbf3c22d67d55457db27e5e41789c26789be82 (diff)
chore: process the first 1000 rules only
Diffstat (limited to 'internal/testhelpers')
-rw-r--r--internal/testhelpers/tmpdir.go24
1 files changed, 11 insertions, 13 deletions
diff --git a/internal/testhelpers/tmpdir.go b/internal/testhelpers/tmpdir.go
index 81f0781b..5765d308 100644
--- a/internal/testhelpers/tmpdir.go
+++ b/internal/testhelpers/tmpdir.go
@@ -15,24 +15,22 @@ import (
var fs = vfs.Instrumented(&local.VFS{})
-func TmpDir(t *testing.T, pattern string) (vfs.Root, string, func()) {
+func TmpDir(tb testing.TB, pattern string) (vfs.Root, string) {
+ tb.Helper()
+
tmpDir, err := ioutil.TempDir("", pattern)
- if t != nil {
- require.NoError(t, err)
- }
+ require.NoError(tb, err)
// On some systems `/tmp` can be a symlink
tmpDir, err = filepath.EvalSymlinks(tmpDir)
- if t != nil {
- require.NoError(t, err)
- }
+ require.NoError(tb, err)
root, err := fs.Root(context.Background(), tmpDir)
- if t != nil {
- require.NoError(t, err)
- }
+ require.NoError(tb, err)
+
+ tb.Cleanup(func() {
+ require.NoError(tb, os.RemoveAll(tmpDir))
+ })
- return root, tmpDir, func() {
- os.RemoveAll(tmpDir)
- }
+ return root, tmpDir
}