Browse Source

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.
pull/3346/head
Anton Kaliaev 5 years ago
committed by GitHub
parent
commit
67fd428354
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      consensus/wal_test.go

+ 7
- 6
consensus/wal_test.go View File

@ -156,18 +156,19 @@ func TestWALPeriodicSync(t *testing.T) {
wal.SetFlushInterval(walTestFlushInterval)
wal.SetLogger(log.TestingLogger())
require.NoError(t, wal.Start())
defer func() {
wal.Stop()
wal.Wait()
}()
// Generate some data
err = WALGenerateNBlocks(t, wal.Group(), 5)
require.NoError(t, err)
// We should have data in the buffer now
assert.NotZero(t, wal.Group().Buffered())
require.NoError(t, wal.Start())
defer func() {
wal.Stop()
wal.Wait()
}()
time.Sleep(walTestFlushInterval + (10 * time.Millisecond))
// The data should have been flushed by the periodic sync


Loading…
Cancel
Save