Skip to content

Commit

Permalink
Merge pull request #5157 from AkihiroSuda/deflake-TestRestartMonitor
Browse files Browse the repository at this point in the history
deflake TestRestartMonitor
  • Loading branch information
estesp committed Mar 11, 2021
2 parents 2b1e913 + ee84e85 commit 8634cd9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions restart_monitor_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,19 @@ 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())
return
if status.Status == Running {
elapsed := time.Since(begin)
t.Logf("the task was restarted within %s", elapsed.String())
return
}
}
time.Sleep(epsilon)
}
Expand Down

0 comments on commit 8634cd9

Please sign in to comment.