Dont panic on not found error when trying to delete servics in cleanup
In the cleanup process we try to clean the namespace,
if the service was deleted right after the list command we shouldn't
panic on that.
@@ -135,7 +135,11 @@ func CleanNamespaces() {
svcList, err := virtCli.CoreV1().Services(namespace).List(context.Background(), metav1.ListOptions{})
util.PanicOnError(err)
for _, svc := range svcList.Items {
- util.PanicOnError(virtCli.CoreV1().Services(namespace).Delete(context.Background(), svc.Name, metav1.DeleteOptions{}))
+ err := virtCli.CoreV1().Services(namespace).Delete(context.Background(), svc.Name, metav1.DeleteOptions{})
+ if errors.IsNotFound(err) {
+ continue
+ }
+ Expect(err).ToNot(HaveOccurred())
}
// Remove PVCs
