Merge pull request #5727 from dmcgowan/test-monitor-restart-grace

Add timestamp to flaky restart monitor test
This commit is contained in:
Phil Estes 2021-07-13 16:18:57 -04:00 committed by GitHub
commit 34fb8d8967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ version = 2
task.Kill(ctx, syscall.SIGKILL)
begin := time.Now()
deadline := begin.Add(interval).Add(epsilon)
for time.Now().Before(deadline) {
for {
status, err := task.Status(ctx)
now := time.Now()
if err != nil {
@ -97,10 +97,13 @@ version = 2
return
}
}
if time.Now().After(deadline) {
break
}
time.Sleep(epsilon)
}
t.Fatalf("the task was not restarted in %s + %s",
interval.String(), epsilon.String())
t.Fatalf("%v: the task was not restarted in %s + %s",
time.Now(), interval.String(), epsilon.String())
}
// withRestartStatus is a copy of "github.com/containerd/containerd/runtime/restart".WithStatus.