Skip to content

Commit

Permalink
fix close
Browse files Browse the repository at this point in the history
  • Loading branch information
JekaMas committed Jun 3, 2022
1 parent 208133b commit f8a56b8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/bor/bor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func TestInsertingSpanSizeBlocks(t *testing.T) {

_, span := loadSpanFromFile(t)

h.EXPECT().Close().AnyTimes()
h.EXPECT().FetchLatestCheckpoint().Return(&bor.Checkpoint{
Proposer: span.SelectedProducers[0].Address,
StartBlock: big.NewInt(0),
Expand Down Expand Up @@ -80,6 +81,8 @@ func TestFetchStateSyncEvents(t *testing.T) {
engine := init.ethereum.Engine()
_bor := engine.(*bor.Bor)

defer engine.Close()

// A. Insert blocks for 0th sprint
db := init.ethereum.ChainDb()
block := init.genesis.ToBlock(db)
Expand All @@ -97,6 +100,7 @@ func TestFetchStateSyncEvents(t *testing.T) {
defer ctrl.Finish()

h := mocks.NewMockIHeimdallClient(ctrl)
h.EXPECT().Close().AnyTimes()

// B.2 Mock State Sync events
fromID := uint64(1)
Expand All @@ -123,13 +127,16 @@ func TestFetchStateSyncEvents_2(t *testing.T) {
engine := init.ethereum.Engine()
_bor := engine.(*bor.Bor)

defer _bor.Close()

// Mock /bor/span/1
res, _ := loadSpanFromFile(t)

ctrl := gomock.NewController(t)
defer ctrl.Finish()

h := mocks.NewMockIHeimdallClient(ctrl)
h.EXPECT().Close().AnyTimes()
h.EXPECT().FetchWithRetry(spanPath, "").Return(res, nil).AnyTimes()

// Mock State Sync events
Expand Down Expand Up @@ -190,9 +197,12 @@ func TestOutOfTurnSigning(t *testing.T) {
engine := init.ethereum.Engine()
_bor := engine.(*bor.Bor)

defer _bor.Close()

h, _, ctrl := getMockedHeimdallClient(t)
defer ctrl.Finish()

h.EXPECT().Close().AnyTimes()
_bor.SetHeimdallClient(h)

db := init.ethereum.ChainDb()
Expand Down Expand Up @@ -243,9 +253,13 @@ func TestSignerNotFound(t *testing.T) {
engine := init.ethereum.Engine()
_bor := engine.(*bor.Bor)

defer _bor.Close()

h, _, ctrl := getMockedHeimdallClient(t)
defer ctrl.Finish()

h.EXPECT().Close().AnyTimes()

_bor.SetHeimdallClient(h)

db := init.ethereum.ChainDb()
Expand Down

0 comments on commit f8a56b8

Please sign in to comment.