Просмотр исходного кода

compactor: wait for After() in TestPeriodic

If the test calls clock.Advance() after the compactor checks clock.Now()
but before the compactor calls clock.After(), the compactor will wait
forever on clock.After() expecting the lost clock.Advance().

Reproduced failure by putting a Sleep() in the clock.Now() continue path.

Fixes #6060 (again)
Anthony Romano 9 лет назад
Родитель
Сommit
5eff6fb7db
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      compactor/compactor_test.go

+ 4 - 1
compactor/compactor_test.go

@@ -47,7 +47,10 @@ func TestPeriodic(t *testing.T) {
 			fc.Advance(checkCompactionInterval)
 			fc.Advance(checkCompactionInterval)
 			rg.Wait(1)
 			rg.Wait(1)
 		}
 		}
-		// ready to acknowledge hour "i"; unblock clock
+		// ready to acknowledge hour "i"
+		// block until compactor calls clock.After()
+		fc.BlockUntil(1)
+		// unblock the After()
 		fc.Advance(checkCompactionInterval)
 		fc.Advance(checkCompactionInterval)
 		a, err := compactable.Wait(1)
 		a, err := compactable.Wait(1)
 		if err != nil {
 		if err != nil {