Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Close commander in tests even when Start function was not called #630

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commander/deposit_batches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func newClientWithGenesisState(t *testing.T, storage *st.TestStorage) *eth.TestC
}

func (s *DepositBatchesTestSuite) TearDownTest() {
stopCommander(s.cmd)
s.cmd.stopWorkersAndWait()
s.client.Close()
err := s.storage.Teardown()
s.NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion commander/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (s *MigrateTestSuite) SetupTest() {
}

func (s *MigrateTestSuite) TearDownTest() {
stopCommander(s.cmd)
s.cmd.stopWorkersAndWait()
err := s.storage.Teardown()
s.NoError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion commander/mm_batches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *MMBatchesTestSuite) SetupTest() {
}

func (s *MMBatchesTestSuite) TearDownTest() {
stopCommander(s.cmd)
s.cmd.stopWorkersAndWait()
s.client.Close()
err := s.storage.Teardown()
s.NoError(err)
Expand Down
8 changes: 0 additions & 8 deletions commander/new_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (s *NewBlockLoopTestSuite) SetupTest() {

func (s *NewBlockLoopTestSuite) TearDownTest() {
s.cmd.stopWorkersAndWait()
stopCommander(s.cmd)
s.client.Close()
err := s.storage.Teardown()
s.NoError(err)
Expand Down Expand Up @@ -281,13 +280,6 @@ func setStateLeaves(t *testing.T, storage *st.Storage) {
require.NoError(t, err)
}

func stopCommander(cmd *Commander) {
if !cmd.isActive() {
return
}
cmd.stopWorkersAndWait()
}

func TestNewBlockLoopTestSuite(t *testing.T) {
suite.Run(t, new(NewBlockLoopTestSuite))
}
3 changes: 1 addition & 2 deletions commander/sync_stake_withdrawals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func (s *SyncStakeWithdrawalsTestSuite) SetupTest() {

func (s *SyncStakeWithdrawalsTestSuite) TearDownTest() {
s.cmd.stopWorkersAndWait()
stopCommander(s.cmd)
s.client.Close()
err := s.storage.Teardown()
s.NoError(err)
Expand Down Expand Up @@ -94,7 +93,7 @@ func (s *SyncStakeWithdrawalsTestSuite) TestNewBlockLoop_DoesNotSendStakeWithdra
"timeout when waiting for StakeWithdrawEvent",
)

stopCommander(s.cmd)
s.cmd.stopWorkersAndWait()

startBlock, err := s.client.GetLatestBlockNumber()
s.NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion commander/txs_batches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (s *TxsBatchesTestSuite) SetupTest() {
}

func (s *TxsBatchesTestSuite) TearDownTest() {
stopCommander(s.cmd)
s.cmd.stopWorkersAndWait()
s.client.Close()
err := s.storage.Teardown()
s.NoError(err)
Expand Down