Skip to content

Commit

Permalink
fix time out to wait egressgateway status to be empty after delete th…
Browse files Browse the repository at this point in the history
…e polices

Signed-off-by: bzsuni <[email protected]>
  • Loading branch information
bzsuni committed Feb 21, 2024
1 parent 14aaeaf commit 4f0c0fb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/e2e/reliability/reliability_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit 4f0c0fb

Please sign in to comment.