diff --git a/repo/fsrepo/fsrepo_test.go b/repo/fsrepo/fsrepo_test.go index 6650c2602e2..dde675a8f50 100644 --- a/repo/fsrepo/fsrepo_test.go +++ b/repo/fsrepo/fsrepo_test.go @@ -1,28 +1,22 @@ package fsrepo import ( - "os" - "path" + "io/ioutil" "testing" "github.com/jbenet/go-ipfs/repo/config" ) -// NB: These tests cannot be run in parallel - -func init() { - // ensure tests begin in clean state - os.RemoveAll(testRepoDir) -} - -const testRepoDir = "./fsrepo_test/repos" - -func testRepoPath(p string) string { - return path.Join(testRepoDir, p) +func testRepoPath(p string, t *testing.T) string { + name, err := ioutil.TempDir("", p) + if err != nil { + t.Fatal(err) + } + return name } func TestCannotRemoveIfOpen(t *testing.T) { - path := testRepoPath("TestCannotRemoveIfOpen") + path := testRepoPath("TestCannotRemoveIfOpen", t) AssertNil(Init(path, &config.Config{}), t, "should initialize successfully") r := At(path) AssertNil(r.Open(), t) @@ -32,8 +26,8 @@ func TestCannotRemoveIfOpen(t *testing.T) { } func TestCanManageReposIndependently(t *testing.T) { - pathA := testRepoPath("a") - pathB := testRepoPath("b") + pathA := testRepoPath("a", t) + pathB := testRepoPath("b", t) t.Log("initialize two repos") AssertNil(Init(pathA, &config.Config{}), t, "should initialize successfully") diff --git a/repo/fsrepo/fsrepo_test/.gitkeep b/repo/fsrepo/fsrepo_test/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/repo/fsrepo/fsrepo_test/README.md b/repo/fsrepo/fsrepo_test/README.md deleted file mode 100644 index 2c80c41bb2f..00000000000 --- a/repo/fsrepo/fsrepo_test/README.md +++ /dev/null @@ -1 +0,0 @@ -This directory is used to store FSRepos generated during go tests.