From 4f0c0fb5c0e6334ee77cc219552c6e89107c5124 Mon Sep 17 00:00:00 2001 From: bzsuni Date: Mon, 5 Feb 2024 14:11:19 +0800 Subject: [PATCH] fix time out to wait egressgateway status to be empty after delete the polices Signed-off-by: bzsuni --- test/e2e/reliability/reliability_ip_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/e2e/reliability/reliability_ip_test.go b/test/e2e/reliability/reliability_ip_test.go index 5ec5c4253..ed75f0fbf 100644 --- a/test/e2e/reliability/reliability_ip_test.go +++ b/test/e2e/reliability/reliability_ip_test.go @@ -13,6 +13,7 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" egressv1 "github.com/spidernet-io/egressgateway/pkg/k8s/apis/v1beta1" "github.com/spidernet-io/egressgateway/test/e2e/common" @@ -137,11 +138,19 @@ var _ = Describe("IP Allocation", Label("Reliability_IP"), func() { // check eip after policies deleted By("check egressgateway status should be empty") - err = common.WaitEGWSyncedWithEGP(cli, egw, egressConfig.EnableIPv4, egressConfig.EnableIPv6, 0, deletionThresholdTime) - Expect(err).NotTo(HaveOccurred()) + Eventually(ctx, func() []egressv1.Eips { + eips := make([]egressv1.Eips, 0) + _ = cli.Get(ctx, types.NamespacedName{Namespace: egw.Namespace, Name: egw.Name}, egw) + for _, eipStatus := range egw.Status.NodeList { + eips = append(eips, eipStatus.Eips...) + } + return eips + }).WithTimeout(time.Minute*2).WithPolling(time.Second*2).Should(BeEmpty(), + fmt.Sprintf("failed to wait the egressgateway: %s status to be empty, egressgateway yaml: %v", egw.Name, egw)) deletionTime := time.Since(deletionStart) // check egessgateway ip number + By("check egressgateway status IPUsage") if egressConfig.EnableIPv4 { Expect(egw.Status.IPUsage.IPv4Free).To(Equal(int(IPNum))) Expect(egw.Status.IPUsage.IPv4Total).To(Equal(int(IPNum)))