diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2018-03-08 19:13:11 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2018-03-08 19:13:11 +0300 |
commit | 0a94a639adf87d0e2ad20eeefc2aaaef6f376701 (patch) | |
tree | 1f76484eb960976f19d925de5865494f425b5ed5 /domains_test.go | |
parent | 1b45fd2c9a9d0e4bc39516c257115c6186d103b2 (diff) |
Don't allow custom root dir
Diffstat (limited to 'domains_test.go')
-rw-r--r-- | domains_test.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/domains_test.go b/domains_test.go index 36321edb..af1594e1 100644 --- a/domains_test.go +++ b/domains_test.go @@ -5,7 +5,6 @@ import ( "fmt" "io/ioutil" "os" - "path/filepath" "testing" "time" @@ -91,18 +90,17 @@ func TestWatchDomains(t *testing.T) { func BenchmarkReadGroups(b *testing.B) { testRoot, err := ioutil.TempDir("", "gitlab-pages-test") require.NoError(b, err) - testRoot, err = filepath.EvalSymlinks(testRoot) + + cwd, err := os.Getwd() require.NoError(b, err) - defer func(dir string) { - fmt.Printf("cleaning up test directory %s\n", dir) - os.RemoveAll(dir) - }(testRoot) + defer func(oldWd, testWd string) { + os.Chdir(oldWd) + fmt.Printf("cleaning up test directory %s\n", testWd) + os.RemoveAll(testWd) + }(cwd, testRoot) - defer func(d string) { - rootDir = d - }(rootDir) - rootDir = testRoot + require.NoError(b, os.Chdir(testRoot)) nGroups := 10000 b.Logf("creating fake domains directory with %d groups", nGroups) |