From e3b7172d7ccd86d12d96fd9ff38b9205eaa3bd9f Mon Sep 17 00:00:00 2001 From: Or Mergi Date: Sun, 17 Nov 2024 15:19:01 +0200 Subject: [PATCH] test,networksegmentation: Wait for CUDN object be gone On CUDN cleanup is inconsistent as we see some flaky tests due to CUDN "already exist" errors, implying object are not actually deleted. Wait for CUDN object be gone when deleted. Signed-off-by: Or Mergi --- test/extended/networking/network_segmentation.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/extended/networking/network_segmentation.go b/test/extended/networking/network_segmentation.go index 3c03f37636da..0aeb8a566d73 100644 --- a/test/extended/networking/network_segmentation.go +++ b/test/extended/networking/network_segmentation.go @@ -560,6 +560,10 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User Expect(err).NotTo(HaveOccurred()) _, err = e2ekubectl.RunKubectl("", "delete", "clusteruserdefinednetwork", c.name) Expect(err).NotTo(HaveOccurred()) + Eventually(func() bool { + _, err := e2ekubectl.RunKubectl("", "get", "clusteruserdefinednetwork", c.name) + return kerrors.IsNotFound(err) + }, 1*time.Minute, 3*time.Second).Should(BeTrueBecause("ClusterUserDefinedNetwork %q should be gone", c.name)) }) Expect(waitForClusterUserDefinedNetworkReady(c.name, 5*time.Second)).To(Succeed()) return err @@ -728,6 +732,10 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User DeferCleanup(func() error { cleanup() _, _ = e2ekubectl.RunKubectl("", "delete", clusterUserDefinedNetworkResource, testClusterUdnName) + Eventually(func() bool { + _, err := e2ekubectl.RunKubectl("", "get", clusterUserDefinedNetworkResource, testClusterUdnName) + return kerrors.IsNotFound(err) + }, 1*time.Minute, 3*time.Second).Should(BeTrueBecause("ClusterUserDefinedNetwork %q should be gone", testClusterUdnName)) return nil }) Expect(err).NotTo(HaveOccurred()) @@ -942,6 +950,10 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User DeferCleanup(func() error { cleanup() _, _ = e2ekubectl.RunKubectl("", "delete", "clusteruserdefinednetwork", cudnName) + Eventually(func() bool { + _, err := e2ekubectl.RunKubectl("", "get", "clusteruserdefinednetwork", cudnName) + return kerrors.IsNotFound(err) + }, 1*time.Minute, 3*time.Second).Should(BeTrueBecause("ClusterUserDefinedNetwork %q should be gone", cudnName)) return nil })