Added utitlity function that waits until a specified pod disappears from cluster
@@ -2437,6 +2437,15 @@ func WaitForSuccessfulVMIStartWithTimeoutIgnoreWarnings(vmi runtime.Object, seco
return waitForVMIStart(vmi, seconds, true)
}
+func WaitForPodToDisappearWithTimeout(podName string, seconds int) {
+ virtClient, err := kubecli.GetKubevirtClient()
+ ExpectWithOffset(1, err).ToNot(HaveOccurred())
+ EventuallyWithOffset(1, func() bool {
+ _, err := virtClient.CoreV1().Pods(NamespaceTestDefault).Get(podName, metav1.GetOptions{})
+ return errors.IsNotFound(err)
+ }, seconds, 1*time.Second).Should(BeTrue())
+}
+
func WaitForVirtualMachineToDisappearWithTimeout(vmi *v1.VirtualMachineInstance, seconds int) {
virtClient, err := kubecli.GetKubevirtClient()
ExpectWithOffset(1, err).ToNot(HaveOccurred())
