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 <alukiano@redhat.com>
This commit is contained in:
Artyom Lukianov 2021-01-24 18:03:31 +02:00
parent 2a4c956b0c
commit 97ac255513
2 changed files with 5 additions and 13 deletions

View File

@ -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)
})
}

View File

@ -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)
})
})