Browse Source

compactor: fix race in TestPeriodic

Test ordering now similar to TestPeriodicPause

Fixes #6060
Anthony Romano 9 years ago
parent
commit
76a99fa1c3
1 changed files with 5 additions and 2 deletions
  1. 5 2
      compactor/compactor_test.go

+ 5 - 2
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)