diff --git a/internal/consensus/byzantine_test.go b/internal/consensus/byzantine_test.go index 5408f2969..0e3013d95 100644 --- a/internal/consensus/byzantine_test.go +++ b/internal/consensus/byzantine_test.go @@ -255,7 +255,6 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { } msg, err := s.Next(ctx) - assert.NoError(t, err) if err != nil { cancel() diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index 19d86dac8..bf790bf90 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -201,6 +201,8 @@ LOOP: i++ select { + case <-rctx.Done(): + t.Fatal("context canceled before test completed") case err := <-walPanicked: // make sure we can make blocks after a crash startNewStateAndWaitForBlock(ctx, t, consensusReplayConfig, cs.Height, blockDB, stateStore) diff --git a/internal/consensus/state_test.go b/internal/consensus/state_test.go index 25158a1d8..43277eecc 100644 --- a/internal/consensus/state_test.go +++ b/internal/consensus/state_test.go @@ -2131,7 +2131,11 @@ func subscribe( t.Errorf("Subscription for %v unexpectedly terminated: %v", q, err) return } - ch <- next + select { + case ch <- next: + case <-ctx.Done(): + return + } } }() return ch diff --git a/internal/consensus/wal_test.go b/internal/consensus/wal_test.go index f686fece6..24b1d3dfc 100644 --- a/internal/consensus/wal_test.go +++ b/internal/consensus/wal_test.go @@ -3,6 +3,7 @@ package consensus import ( "bytes" "context" + "errors" "path/filepath" "testing" @@ -15,6 +16,7 @@ import ( "github.com/tendermint/tendermint/internal/consensus/types" "github.com/tendermint/tendermint/internal/libs/autofile" "github.com/tendermint/tendermint/libs/log" + "github.com/tendermint/tendermint/libs/service" tmtime "github.com/tendermint/tendermint/libs/time" tmtypes "github.com/tendermint/tendermint/types" ) @@ -185,7 +187,9 @@ func TestWALPeriodicSync(t *testing.T) { require.NoError(t, wal.Start(ctx)) t.Cleanup(func() { if err := wal.Stop(); err != nil { - t.Error(err) + if !errors.Is(err, service.ErrAlreadyStopped) { + t.Error(err) + } } wal.Wait() })