From 97ac255513bf8f28d59de12518202e9d0dcf643f Mon Sep 17 00:00:00 2001 From: Artyom Lukianov Date: Sun, 24 Jan 2021 18:03:31 +0200 Subject: [PATCH] e2e: move deleteState file to the AfterEach Under the CPU manager and topology manager e2e tests possible the situation when one of steps under the test will fail and it will not clean the CPU manager state file. Move the deletion of the state file to `AfterEach` to guarantee that the state file will be always removed from the node. Signed-off-by: Artyom Lukianov --- test/e2e_node/cpu_manager_test.go | 2 ++ test/e2e_node/topology_manager_test.go | 16 +++------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/test/e2e_node/cpu_manager_test.go b/test/e2e_node/cpu_manager_test.go index eec1c3a8983..f3a81a89456 100644 --- a/test/e2e_node/cpu_manager_test.go +++ b/test/e2e_node/cpu_manager_test.go @@ -627,7 +627,9 @@ func runCPUManagerTests(f *framework.Framework) { ginkgo.By("wait for the deleted pod to be cleaned up from the state file") waitForStateFileCleanedUp() ginkgo.By("the deleted pod has already been deleted from the state file") + }) + ginkgo.AfterEach(func() { setOldKubeletConfig(f, oldCfg) }) } diff --git a/test/e2e_node/topology_manager_test.go b/test/e2e_node/topology_manager_test.go index a40a66b70e0..fb415609b04 100644 --- a/test/e2e_node/topology_manager_test.go +++ b/test/e2e_node/topology_manager_test.go @@ -880,11 +880,6 @@ func runTopologyManagerTests(f *framework.Framework) { // Run the tests runTopologyManagerPolicySuiteTests(f) } - // restore kubelet config - setOldKubeletConfig(f, oldCfg) - - // Delete state file to allow repeated runs - deleteStateFile() }) ginkgo.It("run Topology Manager node alignment test suite", func() { @@ -922,12 +917,6 @@ func runTopologyManagerTests(f *framework.Framework) { runTopologyManagerNodeAlignmentSuiteTests(f, sd, reservedSystemCPUs, policy, numaNodes, coreCount) } - - // restore kubelet config - setOldKubeletConfig(f, oldCfg) - - // Delete state file to allow repeated runs - deleteStateFile() }) ginkgo.It("run the Topology Manager pod scope alignment test suite", func() { @@ -956,9 +945,11 @@ func runTopologyManagerTests(f *framework.Framework) { reservedSystemCPUs := configureTopologyManagerInKubelet(f, oldCfg, policy, scope, configMap, numaNodes) runTMScopeResourceAlignmentTestSuite(f, configMap, reservedSystemCPUs, policy, numaNodes, coreCount) + }) + ginkgo.AfterEach(func() { + // restore kubelet config setOldKubeletConfig(f, oldCfg) - deleteStateFile() }) } @@ -969,5 +960,4 @@ var _ = SIGDescribe("Topology Manager [Serial] [Feature:TopologyManager][NodeFea ginkgo.Context("With kubeconfig updated to static CPU Manager policy run the Topology Manager tests", func() { runTopologyManagerTests(f) }) - })