mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 04:55:18 +00:00
consensus: improve cleanup of wal tests (#7878)
This commit is contained in:
@@ -151,6 +151,7 @@ func TestWALSearchForEndHeight(t *testing.T) {
|
||||
|
||||
wal, err := NewWAL(ctx, logger, walFile)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { wal.Stop(); wal.Wait() })
|
||||
|
||||
h := int64(3)
|
||||
gr, found, err := wal.SearchForEndHeight(h, &WALSearchOptions{})
|
||||
@@ -165,6 +166,8 @@ func TestWALSearchForEndHeight(t *testing.T) {
|
||||
rs, ok := msg.Msg.(tmtypes.EventDataRoundState)
|
||||
assert.True(t, ok, "expected message of type EventDataRoundState")
|
||||
assert.Equal(t, rs.Height, h+1, "wrong height")
|
||||
|
||||
t.Cleanup(leaktest.Check(t))
|
||||
}
|
||||
|
||||
func TestWALPeriodicSync(t *testing.T) {
|
||||
@@ -188,10 +191,7 @@ func TestWALPeriodicSync(t *testing.T) {
|
||||
assert.NotZero(t, wal.Group().Buffered())
|
||||
|
||||
require.NoError(t, wal.Start(ctx))
|
||||
t.Cleanup(func() {
|
||||
wal.Stop()
|
||||
wal.Wait()
|
||||
})
|
||||
t.Cleanup(func() { wal.Stop(); wal.Wait() })
|
||||
|
||||
time.Sleep(walTestFlushInterval + (10 * time.Millisecond))
|
||||
|
||||
@@ -206,4 +206,6 @@ func TestWALPeriodicSync(t *testing.T) {
|
||||
if gr != nil {
|
||||
gr.Close()
|
||||
}
|
||||
|
||||
t.Cleanup(leaktest.Check(t))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user