Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit ffe73cd

Browse files
authored
Merge pull request #246 from nipuntalukdar/fixatest
fixed an issue in TestWALRestoreCorrupted
2 parents 6c62437 + 6537ee8 commit ffe73cd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

wal_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"math/rand"
2020
"os"
2121
"testing"
22+
"time"
2223

2324
"github.com/go-kit/kit/log"
2425
"github.com/prometheus/tsdb/fileutil"
@@ -370,6 +371,11 @@ func TestWALRestoreCorrupted(t *testing.T) {
370371

371372
testutil.Ok(t, w.cut())
372373

374+
// Sleep 2 seconds to avoid error where cut and test "cases" function may write or
375+
// truncate the file out of orders as "cases" are not synchronized with cut.
376+
// Hopefully cut will complete by 2 seconds.
377+
time.Sleep(2 * time.Second)
378+
373379
testutil.Ok(t, w.LogSamples([]RefSample{{T: 3, V: 4}}))
374380
testutil.Ok(t, w.LogSamples([]RefSample{{T: 5, V: 6}}))
375381

0 commit comments

Comments
 (0)