Close test dbs

This commit is contained in:
Alex Peters
2022-11-29 17:30:59 +01:00
committed by Simon Warta
parent a589fe91e8
commit 52ecb85f78

View File

@@ -59,10 +59,12 @@ func setup(t testing.TB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Opt
snapshotDir := filepath.Join(nodeHome, "data", "snapshots")
snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir)
require.NoError(t, err)
t.Cleanup(func() { snapshotDB.Close() })
snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir)
require.NoError(t, err)
baseAppOpts := []func(*bam.BaseApp){bam.SetSnapshotStore(snapshotStore), bam.SetSnapshotKeepRecent(2)}
db := dbm.NewMemDB()
t.Cleanup(func() { db.Close() })
app := NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, nodeHome, invCheckPeriod, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, opts, baseAppOpts...)
if withGenesis {
return app, NewDefaultGenesisState()