2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-16 01:57:10 +00:00

Remove tempfiles after test

This commit is contained in:
Alexander Neumann 2015-10-31 14:53:03 +01:00
parent fccde030d5
commit ed9470b19d

View File

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