Merge pull request #5727 from dmcgowan/test-monitor-restart-grace
Add timestamp to flaky restart monitor test
This commit is contained in:
commit
34fb8d8967
@ -81,7 +81,7 @@ version = 2
|
|||||||
task.Kill(ctx, syscall.SIGKILL)
|
task.Kill(ctx, syscall.SIGKILL)
|
||||||
begin := time.Now()
|
begin := time.Now()
|
||||||
deadline := begin.Add(interval).Add(epsilon)
|
deadline := begin.Add(interval).Add(epsilon)
|
||||||
for time.Now().Before(deadline) {
|
for {
|
||||||
status, err := task.Status(ctx)
|
status, err := task.Status(ctx)
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -97,10 +97,13 @@ version = 2
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if time.Now().After(deadline) {
|
||||||
|
break
|
||||||
|
}
|
||||||
time.Sleep(epsilon)
|
time.Sleep(epsilon)
|
||||||
}
|
}
|
||||||
t.Fatalf("the task was not restarted in %s + %s",
|
t.Fatalf("%v: the task was not restarted in %s + %s",
|
||||||
interval.String(), epsilon.String())
|
time.Now(), interval.String(), epsilon.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// withRestartStatus is a copy of "github.com/containerd/containerd/runtime/restart".WithStatus.
|
// withRestartStatus is a copy of "github.com/containerd/containerd/runtime/restart".WithStatus.
|
||||||
|
Loading…
Reference in New Issue
Block a user