deflake TestRestartMonitor
Fix #5146 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
2b1e913679
commit
ee84e85758
@ -82,16 +82,20 @@ version = 2
|
||||
deadline := begin.Add(interval).Add(epsilon)
|
||||
for time.Now().Before(deadline) {
|
||||
status, err := task.Status(ctx)
|
||||
now := time.Now()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("%v: status=%q", time.Now(), status)
|
||||
// ErrNotFound is expected here, because the restart monitor
|
||||
// temporarily removes the task before restarting.
|
||||
t.Logf("%v: err=%v", now, err)
|
||||
} else {
|
||||
t.Logf("%v: status=%q", now, status)
|
||||
|
||||
if status.Status == Running {
|
||||
elapsed := time.Since(begin)
|
||||
t.Logf("the task was restarted after %s", elapsed.String())
|
||||
t.Logf("the task was restarted within %s", elapsed.String())
|
||||
return
|
||||
}
|
||||
}
|
||||
time.Sleep(epsilon)
|
||||
}
|
||||
t.Fatalf("the task was not restarted in %s + %s",
|
||||
|
Loading…
Reference in New Issue
Block a user