diff options
Diffstat (limited to 'swarm/shed/db_test.go')
-rw-r--r-- | swarm/shed/db_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/swarm/shed/db_test.go b/swarm/shed/db_test.go index 65fdac4a6..4e8276f74 100644 --- a/swarm/shed/db_test.go +++ b/swarm/shed/db_test.go @@ -100,11 +100,13 @@ func newTestDB(t *testing.T) (db *DB, cleanupFunc func()) { if err != nil { t.Fatal(err) } - cleanupFunc = func() { os.RemoveAll(dir) } db, err = NewDB(dir, "") if err != nil { - cleanupFunc() + os.RemoveAll(dir) t.Fatal(err) } - return db, cleanupFunc + return db, func() { + db.Close() + os.RemoveAll(dir) + } } |