diff --git a/test/e2e_node/podresources_test.go b/test/e2e_node/podresources_test.go index b8704861211..0cc8cc195fb 100644 --- a/test/e2e_node/podresources_test.go +++ b/test/e2e_node/podresources_test.go @@ -21,6 +21,7 @@ import ( "fmt" "io/ioutil" "strings" + "sync" "time" v1 "k8s.io/api/core/v1" @@ -140,12 +141,24 @@ func (tpd *testPodData) createPodsForTest(f *framework.Framework, podReqs []podD } } +/* deletePodsForTest clean up all the pods run for a testcase. Must ensure proper cleanup */ func (tpd *testPodData) deletePodsForTest(f *framework.Framework) { + podNS := f.Namespace.Name + var wg sync.WaitGroup for podName := range tpd.PodMap { - deletePodSyncByName(f, podName) + wg.Add(1) + go func(podName string) { + defer ginkgo.GinkgoRecover() + defer wg.Done() + + deletePodSyncByName(f, podName) + waitForAllContainerRemoval(podName, podNS) + }(podName) } + wg.Wait() } +/* deletePod removes pod during a test. Should do a best-effort clean up */ func (tpd *testPodData) deletePod(f *framework.Framework, podName string) { _, ok := tpd.PodMap[podName] if !ok {