Skip to content

Commit

Permalink
Fix broken integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Artoul committed Oct 17, 2018
1 parent 50b2317 commit 227de8b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/dbnode/integration/disk_cleanup_multi_ns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ func TestDiskCleanupMultipleNamespace(t *testing.T) {
// Move now forward by 12 hours, and see if the expected files have been deleted
testSetup.setNowFn(end)

// This isn't great, but right now the commitlog will only ever rotate when writes
// are received, so we need to issue a write after changing the time to force the
// commitlog rotation. This won't be required once we tie commitlog rotation into
// the snapshotting process.
testSetup.writeBatch(testNamespaces[0], generate.Block(generate.BlockConfig{
IDs: []string{"foo"},
NumPoints: 1,
Start: end,
}))

// Check if expected files have been deleted
log.Infof("waiting until data is cleaned up")
waitTimeout := 60 * time.Second
Expand Down
10 changes: 9 additions & 1 deletion src/dbnode/integration/disk_cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func TestDiskCleanup(t *testing.T) {
}
writeDataFileSetFiles(t, testSetup.storageOpts, md, shard, fileTimes)
for _, clTime := range fileTimes {
// Need to generate valid commit log files otherwise cleanup will fail.
data := map[xtime.UnixNano]generate.SeriesBlock{
xtime.ToUnixNano(clTime): nil,
}
Expand All @@ -89,6 +88,15 @@ func TestDiskCleanup(t *testing.T) {
// and commit logs at now will be deleted
newNow := now.Add(retentionPeriod).Add(2 * blockSize)
testSetup.setNowFn(newNow)
// This isn't great, but right now the commitlog will only ever rotate when writes
// are received, so we need to issue a write after changing the time to force the
// commitlog rotation. This won't be required once we tie commitlog rotation into
// the snapshotting process.
testSetup.writeBatch(testNamespaces[0], generate.Block(generate.BlockConfig{
IDs: []string{"foo"},
NumPoints: 1,
Start: newNow,
}))

// Check if files have been deleted
waitTimeout := 30 * time.Second
Expand Down

0 comments on commit 227de8b

Please sign in to comment.