mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #44014 from corhere/healthcheck-kill-timeout
Un-skip TestHealthCheckProcessKilled on Windows+containerd and stop health checks earlier upon container exit.
This commit is contained in:
commit
e8c4740108
2 changed files with 5 additions and 4 deletions
|
@ -28,6 +28,11 @@ func (daemon *Daemon) setStateCounter(c *container.Container) {
|
||||||
func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontainerdtypes.EventInfo) error {
|
func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontainerdtypes.EventInfo) error {
|
||||||
var exitStatus container.ExitStatus
|
var exitStatus container.ExitStatus
|
||||||
c.Lock()
|
c.Lock()
|
||||||
|
|
||||||
|
// Health checks will be automatically restarted if/when the
|
||||||
|
// container is started again.
|
||||||
|
daemon.stopHealthchecks(c)
|
||||||
|
|
||||||
tsk, ok := c.Task()
|
tsk, ok := c.Task()
|
||||||
if ok {
|
if ok {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
@ -72,9 +77,6 @@ func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontaine
|
||||||
restart = false
|
restart = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// cancel healthcheck here, they will be automatically
|
|
||||||
// restarted if/when the container is started again
|
|
||||||
daemon.stopHealthchecks(c)
|
|
||||||
attributes := map[string]string{
|
attributes := map[string]string{
|
||||||
"exitCode": strconv.Itoa(exitStatus.ExitCode),
|
"exitCode": strconv.Itoa(exitStatus.ExitCode),
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ while true; do sleep 1; done
|
||||||
|
|
||||||
// TestHealthCheckProcessKilled verifies that health-checks exec get killed on time-out.
|
// TestHealthCheckProcessKilled verifies that health-checks exec get killed on time-out.
|
||||||
func TestHealthCheckProcessKilled(t *testing.T) {
|
func TestHealthCheckProcessKilled(t *testing.T) {
|
||||||
skip.If(t, testEnv.RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
|
|
||||||
defer setupTest(t)()
|
defer setupTest(t)()
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
apiClient := testEnv.APIClient()
|
apiClient := testEnv.APIClient()
|
||||||
|
|
Loading…
Add table
Reference in a new issue