From 990d0949c4eb532e86855ee0189d396c533eeb12 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Fri, 19 Mar 2021 16:08:08 +0800 Subject: [PATCH] Add test, after restart dbus, should be able to gracefully shutdown --- test/e2e_node/node_shutdown_linux_test.go | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/e2e_node/node_shutdown_linux_test.go b/test/e2e_node/node_shutdown_linux_test.go index 1ab5666b36f..d12b2f405b1 100644 --- a/test/e2e_node/node_shutdown_linux_test.go +++ b/test/e2e_node/node_shutdown_linux_test.go @@ -178,6 +178,24 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeAlphaFeature:GracefulNod return nil }, nodeStatusUpdateTimeout, pollInterval).Should(gomega.BeNil()) }) + + ginkgo.It("after restart dbus, should be able to gracefully shutdown", func() { + ginkgo.By("Restart Dbus") + err := restartDbus() + framework.ExpectNoError(err) + + ginkgo.By("Emitting Shutdown signal") + err = emitSignalPrepareForShutdown(true) + framework.ExpectNoError(err) + + gomega.Eventually(func() error { + isReady := getNodeReadyStatus(f) + if isReady { + return fmt.Errorf("node did not become shutdown as expected") + } + return nil + }, nodeStatusUpdateTimeout, pollInterval).Should(gomega.BeNil()) + }) }) }) @@ -237,3 +255,9 @@ func getNodeReadyStatus(f *framework.Framework) bool { framework.ExpectEqual(len(nodeList.Items), 1) return isNodeReady(&nodeList.Items[0]) } + +func restartDbus() error { + cmd := "systemctl restart dbus" + _, err := runCommand("sh", "-c", cmd) + return err +}