Merge pull request #44893 from corhere/bump-exit-timeouts-for-runhcs
Wait longer for exit events on Windows
This commit is contained in:
commit
b39c255d8c
2 changed files with 8 additions and 3 deletions
|
@ -146,7 +146,12 @@ func (daemon *Daemon) Kill(container *containerpkg.Container) error {
|
|||
}
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
waitTimeout := 10 * time.Second
|
||||
if runtime.GOOS == "windows" {
|
||||
waitTimeout = 75 * time.Second // runhcs can be sloooooow.
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), waitTimeout)
|
||||
defer cancel()
|
||||
|
||||
status := <-container.Wait(ctx, containerpkg.WaitConditionNotRunning)
|
||||
|
@ -154,7 +159,7 @@ func (daemon *Daemon) Kill(container *containerpkg.Container) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
logrus.WithError(status.Err()).WithField("container", container.ID).Error("Container failed to exit within 10 seconds of kill - trying direct SIGKILL")
|
||||
logrus.WithError(status.Err()).WithField("container", container.ID).Errorf("Container failed to exit within %v of kill - trying direct SIGKILL", waitTimeout)
|
||||
|
||||
if err := killProcessDirectly(container); err != nil {
|
||||
if errors.As(err, &errNoSuchProcess{}) {
|
||||
|
|
|
@ -170,7 +170,7 @@ func TestWaitConditions(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
case waitRes := <-waitResC:
|
||||
assert.Check(t, is.Equal(int64(99), waitRes.StatusCode))
|
||||
case <-time.After(15 * time.Second):
|
||||
case <-time.After(75 * time.Second):
|
||||
info, _ := cli.ContainerInspect(ctx, containerID)
|
||||
t.Fatalf("Timed out waiting for container exit code (status = %q)", info.State.Status)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue