diff --git a/test/e2e_node/node_container_manager_test.go b/test/e2e_node/node_container_manager_test.go index ce66ac65c48..6761e195a3b 100644 --- a/test/e2e_node/node_container_manager_test.go +++ b/test/e2e_node/node_container_manager_test.go @@ -98,19 +98,10 @@ var _ = SIGDescribe("Node Container Manager", framework.WithSerial(), func() { ginkgo.DeferCleanup(func(ctx context.Context) { if oldCfg != nil { // Update the Kubelet configuration. - ginkgo.By("Stopping the kubelet") - startKubelet := stopKubelet() - - // wait until the kubelet health check will fail - gomega.Eventually(ctx, func() bool { - return kubeletHealthCheck(kubeletHealthCheckURL) - }).WithTimeout(time.Minute).WithPolling(time.Second).Should(gomega.BeFalseBecause("expected kubelet health check to be failed")) - ginkgo.By("Stopped the kubelet") - framework.ExpectNoError(e2enodekubelet.WriteKubeletConfigFile(oldCfg)) - ginkgo.By("Starting the kubelet") - startKubelet() + ginkgo.By("Restarting the kubelet") + restartKubelet(true) // wait until the kubelet health check will succeed gomega.Eventually(ctx, func(ctx context.Context) bool { @@ -127,23 +118,14 @@ var _ = SIGDescribe("Node Container Manager", framework.WithSerial(), func() { newCfg.FailCgroupV1 = true // extra safety. We want to avoid false negatives though, so we added the skip check earlier // Update the Kubelet configuration. - ginkgo.By("Stopping the kubelet") - startKubelet := stopKubelet() - - // wait until the kubelet health check will fail - gomega.Eventually(ctx, func() bool { - return kubeletHealthCheck(kubeletHealthCheckURL) - }).WithTimeout(time.Minute).WithPolling(time.Second).Should(gomega.BeFalseBecause("expected kubelet health check to be failed")) - ginkgo.By("Stopped the kubelet") - framework.ExpectNoError(e2enodekubelet.WriteKubeletConfigFile(newCfg)) - ginkgo.By("Starting the kubelet") - startKubelet() + ginkgo.By("Restarting the kubelet") + restartKubelet(true) // wait until the kubelet health check will succeed - gomega.Eventually(ctx, func() bool { - return getNodeReadyStatus(ctx, f) && kubeletHealthCheck(kubeletHealthCheckURL) + gomega.Eventually(ctx, func(ctx context.Context) bool { + return kubeletHealthCheck(kubeletHealthCheckURL) }).WithTimeout(2 * time.Minute).WithPolling(5 * time.Second).Should(gomega.BeTrueBecause("expected kubelet to be in healthy state")) ginkgo.By("Started the kubelet")