Remove tempfiles after test

This commit is contained in:
Alexander Neumann 2015-10-31 14:53:03 +01:00
parent fccde030d5
commit ed9470b19d
1 changed files with 6 additions and 2 deletions

View File

@ -15,7 +15,6 @@ import (
func BenchmarkNodeFillUser(t *testing.B) {
tempfile, err := ioutil.TempFile("", "restic-test-temp-")
defer tempfile.Close()
if err != nil {
t.Fatal(err)
}
@ -32,11 +31,13 @@ func BenchmarkNodeFillUser(t *testing.B) {
for i := 0; i < t.N; i++ {
restic.NodeFromFileInfo(path, fi)
}
OK(t, tempfile.Close())
RemoveAll(t, tempfile.Name())
}
func BenchmarkNodeFromFileInfo(t *testing.B) {
tempfile, err := ioutil.TempFile("", "restic-test-temp-")
defer tempfile.Close()
if err != nil {
t.Fatal(err)
}
@ -56,6 +57,9 @@ func BenchmarkNodeFromFileInfo(t *testing.B) {
t.Fatal(err)
}
}
OK(t, tempfile.Close())
RemoveAll(t, tempfile.Name())
}
func parseTime(s string) time.Time {