aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Snider <csnider@mirantis.com>2022-08-29 18:09:02 -0400
committerGitHub <noreply@github.com>2022-08-29 18:09:02 -0400
commite8c47401085b91df6c48b31f03e2415bdbc924cc (patch)
tree8715040ead42ebada1de02561e406daa3aa2a947
parent5b9492a58ebf9a68f3e0b43b375c030486c26885 (diff)
parent8b748bd326d102e4188f55b78ebd06fea0770ffc (diff)
Merge pull request #44014 from corhere/healthcheck-kill-timeout
Un-skip TestHealthCheckProcessKilled on Windows+containerd and stop health checks earlier upon container exit.
-rw-r--r--daemon/monitor.go8
-rw-r--r--integration/container/health_test.go1
2 files changed, 5 insertions, 4 deletions
diff --git a/daemon/monitor.go b/daemon/monitor.go
index 1e96c1d9d8..33a3d6d866 100644
--- a/daemon/monitor.go
+++ b/daemon/monitor.go
@@ -28,6 +28,11 @@ func (daemon *Daemon) setStateCounter(c *container.Container) {
func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontainerdtypes.EventInfo) error {
var exitStatus container.ExitStatus
c.Lock()
+
+ // Health checks will be automatically restarted if/when the
+ // container is started again.
+ daemon.stopHealthchecks(c)
+
tsk, ok := c.Task()
if ok {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
@@ -72,9 +77,6 @@ func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontaine
restart = false
}
- // cancel healthcheck here, they will be automatically
- // restarted if/when the container is started again
- daemon.stopHealthchecks(c)
attributes := map[string]string{
"exitCode": strconv.Itoa(exitStatus.ExitCode),
}
diff --git a/integration/container/health_test.go b/integration/container/health_test.go
index c55e9e9180..debd5b96f1 100644
--- a/integration/container/health_test.go
+++ b/integration/container/health_test.go
@@ -96,7 +96,6 @@ while true; do sleep 1; done
// TestHealthCheckProcessKilled verifies that health-checks exec get killed on time-out.
func TestHealthCheckProcessKilled(t *testing.T) {
- skip.If(t, testEnv.RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
defer setupTest(t)()
ctx := context.Background()
apiClient := testEnv.APIClient()