Skip to content

Commit

Permalink
implement test cleanup in sync tests (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Intizar-T authored Nov 19, 2024
1 parent 3b841f6 commit 7b963e3
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions sequencer/synchronizer/synchronizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,13 @@ func newTestModules(t *testing.T) (*statedb.StateDB, *historydb.HistoryDB, *l2db
// Init L2 DB
l2DB := l2db.NewL2DB(db, db, 10, 100, 0.0, 1000.0, 24*time.Hour, nil)

return stateDB, historyDB, l2DB
}
t.Cleanup(func() {
test.MigrationsDownTest(historyDB.DB())
stateDB.Close()
l2DB.DB().Close()
})

func closeTestModules(_ *testing.T, statedb *statedb.StateDB, historydb *historydb.HistoryDB, l2db *l2db.L2DB) {
statedb.Close()
_ = l2db.DB().Close()
return stateDB, historyDB, l2DB
}

func newBigInt(s string) *big.Int {
Expand All @@ -284,10 +285,6 @@ func newBigInt(s string) *big.Int {
}

func TestSyncGeneral(t *testing.T) {
//
// Setup
//

stateDB, historyDB, l2DB := newTestModules(t)

// Init eth client
Expand Down Expand Up @@ -522,6 +519,4 @@ func TestSyncGeneral(t *testing.T) {
// Set EthBlockNum for Vars to the blockNum in which they were updated (should be 5)
rollupVars.EthBlockNum = syncBlock.Block.Num
assert.Equal(t, rollupVars, dbRollupVars)

// TODO: implement WipeDB
}

0 comments on commit 7b963e3

Please sign in to comment.