func cleanupDensityTest(dtc DensityTestConfig) { defer GinkgoRecover() By("Deleting created Collections") // We explicitly delete all pods to have API calls necessary for deletion accounted in metrics. for i := range dtc.Configs { name := dtc.Configs[i].GetName() namespace := dtc.Configs[i].GetNamespace() kind := dtc.Configs[i].GetKind() // TODO: Remove Deployment guard once GC is implemented for Deployments. if framework.TestContext.GarbageCollectorEnabled && kind != extensions.Kind("Deployment") { By(fmt.Sprintf("Cleaning up only the %v, garbage collector will clean up the pods", kind)) err := framework.DeleteResourceAndWaitForGC(dtc.ClientSet, kind, namespace, name) framework.ExpectNoError(err) } else { By(fmt.Sprintf("Cleaning up the %v and pods", kind)) err := framework.DeleteResourceAndPods(dtc.ClientSet, dtc.InternalClientset, kind, namespace, name) framework.ExpectNoError(err) } } // Delete all secrets for i := range dtc.SecretConfigs { dtc.SecretConfigs[i].Stop() } for i := range dtc.DaemonConfigs { framework.ExpectNoError(framework.DeleteResourceAndPods( dtc.ClientSet, dtc.InternalClientset, extensions.Kind("DaemonSet"), dtc.DaemonConfigs[i].Namespace, dtc.DaemonConfigs[i].Name, )) } }
func deleteResource(wg *sync.WaitGroup, config testutils.RunObjectConfig, deletingTime time.Duration) { defer GinkgoRecover() defer wg.Done() sleepUpTo(deletingTime) if framework.TestContext.GarbageCollectorEnabled && config.GetKind() != extensions.Kind("Deployment") { framework.ExpectNoError(framework.DeleteResourceAndWaitForGC( config.GetClient(), config.GetKind(), config.GetNamespace(), config.GetName()), fmt.Sprintf("deleting %v %s", config.GetKind(), config.GetName())) } else { framework.ExpectNoError(framework.DeleteResourceAndPods( config.GetClient(), config.GetInternalClient(), config.GetKind(), config.GetNamespace(), config.GetName()), fmt.Sprintf("deleting %v %s", config.GetKind(), config.GetName())) } }