mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #7632 from xiang90/fix_periodic
compactor: fix TestPeriodic
This commit is contained in:
commit
ca22c4c384
@ -42,13 +42,17 @@ func TestPeriodic(t *testing.T) {
|
||||
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++ {
|
||||
fc.Advance(checkCompactionInterval)
|
||||
// advance one (hour - checkCompactionInterval), one revision for each interval
|
||||
for j := 0; j < n-1; j++ {
|
||||
_, err := rg.Wait(1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fc.Advance(checkCompactionInterval)
|
||||
}
|
||||
_, err := rg.Wait(1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// ready to acknowledge hour "i"
|
||||
// block until compactor calls clock.After()
|
||||
@ -63,6 +67,12 @@ func TestPeriodic(t *testing.T) {
|
||||
t.Errorf("compact request = %v, want %v", a[0].Params[0], &pb.CompactionRequest{Revision: int64(i*n) + 1})
|
||||
}
|
||||
}
|
||||
|
||||
// unblock the rev getter, so we can stop the compactor routine.
|
||||
_, err := rg.Wait(1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPeriodicPause(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user