[#945] metabase: Use cleanup instead of defer in tests

Cleanup is more idiomatic way to clean test data

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-10-27 13:56:30 +03:00 committed by Alex Vanin
parent e41aba610d
commit 2271944064
13 changed files with 6 additions and 31 deletions

View file

@ -51,12 +51,12 @@ func newDB(t testing.TB) *meta.DB {
require.NoError(t, bdb.Open())
return bdb
}
t.Cleanup(func() {
bdb.Close()
os.Remove(bdb.DumpInfo().Path)
})
func releaseDB(db *meta.DB) {
db.Close()
os.Remove(db.DumpInfo().Path)
return bdb
}
func generateRawObject(t *testing.T) *object.RawObject {