mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
fix TestWALPeriodicSync (#3342)
The test was sometimes failing due to processFlushTicks being called too early. The solution is to call wal#Start later in the test.
This commit is contained in:
parent
f22ada442a
commit
67fd428354
@ -156,18 +156,19 @@ func TestWALPeriodicSync(t *testing.T) {
|
|||||||
wal.SetFlushInterval(walTestFlushInterval)
|
wal.SetFlushInterval(walTestFlushInterval)
|
||||||
wal.SetLogger(log.TestingLogger())
|
wal.SetLogger(log.TestingLogger())
|
||||||
|
|
||||||
require.NoError(t, wal.Start())
|
// Generate some data
|
||||||
defer func() {
|
|
||||||
wal.Stop()
|
|
||||||
wal.Wait()
|
|
||||||
}()
|
|
||||||
|
|
||||||
err = WALGenerateNBlocks(t, wal.Group(), 5)
|
err = WALGenerateNBlocks(t, wal.Group(), 5)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// We should have data in the buffer now
|
// We should have data in the buffer now
|
||||||
assert.NotZero(t, wal.Group().Buffered())
|
assert.NotZero(t, wal.Group().Buffered())
|
||||||
|
|
||||||
|
require.NoError(t, wal.Start())
|
||||||
|
defer func() {
|
||||||
|
wal.Stop()
|
||||||
|
wal.Wait()
|
||||||
|
}()
|
||||||
|
|
||||||
time.Sleep(walTestFlushInterval + (10 * time.Millisecond))
|
time.Sleep(walTestFlushInterval + (10 * time.Millisecond))
|
||||||
|
|
||||||
// The data should have been flushed by the periodic sync
|
// The data should have been flushed by the periodic sync
|
||||||
|
Loading…
x
Reference in New Issue
Block a user