Skip to content

Commit

Permalink
use TempDir
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshasselberg committed Dec 3, 2014
1 parent 19e7537 commit b45460a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions file_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,17 @@ func TestFileSS_BadPerm(t *testing.T) {
}

func TestFileSS_MissingParentDir(t *testing.T) {
_, err := NewFileSnapshotStore("nonexistent/target", 3, nil)
defer os.RemoveAll("nonexistent/target")
parent, err := ioutil.TempDir("", "raft")
if err != nil {
t.Fatalf("err: %v ", err)
}
defer os.RemoveAll(parent)

dir, err := ioutil.TempDir(parent, "raft")
if err != nil {
t.Fatalf("err: %v ", err)
}
_, err = NewFileSnapshotStore(dir, 3, nil)
if err != nil {
t.Fatalf("should not fail when using non existing parent")
}
Expand Down

0 comments on commit b45460a

Please sign in to comment.