Browse Source

consensus: improve cleanup of wal tests (#7878)

pull/7890/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
81bd9ad812
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      internal/consensus/wal_test.go

+ 6
- 4
internal/consensus/wal_test.go View File

@ -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))
}

Loading…
Cancel
Save