multi: replace defer cleanup with t.Cleanup

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2022-08-27 15:04:55 +08:00
parent 5c5997935d
commit c70e39cd21
29 changed files with 393 additions and 606 deletions

View File

@@ -409,7 +409,6 @@ type nurseryTestContext struct {
sweeper *mockSweeperFull
timeoutChan chan chan time.Time
t *testing.T
dbCleanup func()
}
func createNurseryTestContext(t *testing.T,
@@ -419,7 +418,7 @@ func createNurseryTestContext(t *testing.T,
// alternative, mocking nurseryStore, is not chosen because there is
// still considerable logic in the store.
cdb, cleanup, err := channeldb.MakeTestDB()
cdb, err := channeldb.MakeTestDB(t)
require.NoError(t, err, "unable to open channeldb")
store, err := NewNurseryStore(&chainhash.Hash{}, cdb)
@@ -480,7 +479,6 @@ func createNurseryTestContext(t *testing.T,
sweeper: sweeper,
timeoutChan: timeoutChan,
t: t,
dbCleanup: cleanup,
}
ctx.receiveTx = func() wire.MsgTx {
@@ -528,8 +526,6 @@ func (ctx *nurseryTestContext) notifyEpoch(height int32) {
}
func (ctx *nurseryTestContext) finish() {
defer ctx.dbCleanup()
// Add a final restart point in this state
ctx.restart()