From 86acf3bc8f3594df1cc284bef7c7830caddec53f Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Tue, 24 Aug 2021 15:42:46 +0800 Subject: [PATCH] Fix nodeShutdownReason for node shutdown e2e --- test/e2e_node/node_shutdown_linux_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/e2e_node/node_shutdown_linux_test.go b/test/e2e_node/node_shutdown_linux_test.go index b5715f34fc0..504a3be20b1 100644 --- a/test/e2e_node/node_shutdown_linux_test.go +++ b/test/e2e_node/node_shutdown_linux_test.go @@ -46,6 +46,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeAlphaFeature:GracefulNod ginkgo.Context("when gracefully shutting down", func() { const ( + nodeShutdownReason = "Terminated" pollInterval = 1 * time.Second podStatusUpdateTimeout = 5 * time.Second nodeStatusUpdateTimeout = 10 * time.Second @@ -124,7 +125,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeAlphaFeature:GracefulNod return fmt.Errorf("critical pod should not be shutdown, phase: %s", pod.Status.Phase) } } else { - if pod.Status.Phase != v1.PodFailed || pod.Status.Reason != "Shutdown" { + if pod.Status.Phase != v1.PodFailed || pod.Status.Reason != nodeShutdownReason { framework.Logf("Expecting non-critcal pod to be shutdown, but it's not currently. Pod: %q, Pod Status Phase: %q, Pod Status Reason: %q", pod.Name, pod.Status.Phase, pod.Status.Reason) return fmt.Errorf("pod should be shutdown, phase: %s", pod.Status.Phase) } @@ -145,7 +146,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeAlphaFeature:GracefulNod framework.ExpectEqual(len(list.Items), len(pods), "the number of pods is not as expected") for _, pod := range list.Items { - if pod.Status.Phase != v1.PodFailed || pod.Status.Reason != "Shutdown" { + if pod.Status.Phase != v1.PodFailed || pod.Status.Reason != nodeShutdownReason { framework.Logf("Expecting pod to be shutdown, but it's not currently: Pod: %q, Pod Status Phase: %q, Pod Status Reason: %q", pod.Name, pod.Status.Phase, pod.Status.Reason) return fmt.Errorf("pod should be shutdown, phase: %s", pod.Status.Phase) }