|
@ -151,6 +151,7 @@ func TestWALSearchForEndHeight(t *testing.T) { |
|
|
|
|
|
|
|
|
wal, err := NewWAL(ctx, logger, walFile) |
|
|
wal, err := NewWAL(ctx, logger, walFile) |
|
|
require.NoError(t, err) |
|
|
require.NoError(t, err) |
|
|
|
|
|
t.Cleanup(func() { wal.Stop(); wal.Wait() }) |
|
|
|
|
|
|
|
|
h := int64(3) |
|
|
h := int64(3) |
|
|
gr, found, err := wal.SearchForEndHeight(h, &WALSearchOptions{}) |
|
|
gr, found, err := wal.SearchForEndHeight(h, &WALSearchOptions{}) |
|
@ -165,6 +166,8 @@ func TestWALSearchForEndHeight(t *testing.T) { |
|
|
rs, ok := msg.Msg.(tmtypes.EventDataRoundState) |
|
|
rs, ok := msg.Msg.(tmtypes.EventDataRoundState) |
|
|
assert.True(t, ok, "expected message of type EventDataRoundState") |
|
|
assert.True(t, ok, "expected message of type EventDataRoundState") |
|
|
assert.Equal(t, rs.Height, h+1, "wrong height") |
|
|
assert.Equal(t, rs.Height, h+1, "wrong height") |
|
|
|
|
|
|
|
|
|
|
|
t.Cleanup(leaktest.Check(t)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func TestWALPeriodicSync(t *testing.T) { |
|
|
func TestWALPeriodicSync(t *testing.T) { |
|
@ -188,10 +191,7 @@ func TestWALPeriodicSync(t *testing.T) { |
|
|
assert.NotZero(t, wal.Group().Buffered()) |
|
|
assert.NotZero(t, wal.Group().Buffered()) |
|
|
|
|
|
|
|
|
require.NoError(t, wal.Start(ctx)) |
|
|
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)) |
|
|
time.Sleep(walTestFlushInterval + (10 * time.Millisecond)) |
|
|
|
|
|
|
|
@ -206,4 +206,6 @@ func TestWALPeriodicSync(t *testing.T) { |
|
|
if gr != nil { |
|
|
if gr != nil { |
|
|
gr.Close() |
|
|
gr.Close() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
t.Cleanup(leaktest.Check(t)) |
|
|
} |
|
|
} |