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

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2020-11-20 10:44:28 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-11-24 11:17:07 +0300
commit856676a6b460258e8511093b1bb473f95cc1447a (patch)
tree518ddec8ac916498572b3463b4e2d9362341ffe6
parentcd9d890ce7509bc6d7d8a468a47e41b495c5b5e4 (diff)
namespace: Stop writing data into "testdata"
We're creating a set of custom storages in our "namespace" tests. These storages are currently created in "testdata/", but should instead be created in a temporary directory Fix tests to use `ioutil.TempDir()`. As we don't have a test context available at time of creation, we cannot use `testhelper.TempDir()`.
-rw-r--r--internal/gitaly/service/namespace/namespace_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/gitaly/service/namespace/namespace_test.go b/internal/gitaly/service/namespace/namespace_test.go
index 9ba79e109..bbc46cb17 100644
--- a/internal/gitaly/service/namespace/namespace_test.go
+++ b/internal/gitaly/service/namespace/namespace_test.go
@@ -1,6 +1,7 @@
package namespace
import (
+ "io/ioutil"
"os"
"path/filepath"
"testing"
@@ -25,10 +26,17 @@ func testMain(m *testing.M) int {
cleanup := testhelper.Configure()
defer cleanup()
+ tempDir, err := ioutil.TempDir("", "gitaly-tests")
+ if err != nil {
+ log.Error(err)
+ return 1
+ }
+ defer os.RemoveAll(tempDir)
+
config.Config.Storages = nil
for _, st := range []string{"default", "other"} {
- dir, err := filepath.Abs(filepath.Join("testdata", st))
+ dir, err := filepath.Abs(filepath.Join(tempDir, st))
if err != nil {
log.Error(err)
return 1