From 76a99fa1c3250221d144a60ede653d8e63193f49 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 27 Jul 2016 16:03:22 -0700 Subject: [PATCH] compactor: fix race in TestPeriodic Test ordering now similar to TestPeriodicPause Fixes #6060 --- compactor/compactor_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compactor/compactor_test.go b/compactor/compactor_test.go index b15f892d0..fcb507a98 100644 --- a/compactor/compactor_test.go +++ b/compactor/compactor_test.go @@ -40,12 +40,15 @@ func TestPeriodic(t *testing.T) { defer tb.Stop() n := int(time.Hour / checkCompactionInterval) + // collect 3 hours of revisions for i := 0; i < 3; i++ { + // advance one hour, one revision for each interval for j := 0; j < n; j++ { - rg.Wait(1) fc.Advance(checkCompactionInterval) + rg.Wait(1) } - + // ready to acknowledge hour "i"; unblock clock + fc.Advance(checkCompactionInterval) a, err := compactable.Wait(1) if err != nil { t.Fatal(err)