Skip to content

Commit

Permalink
Merge pull request #1173 from spidernet-io/bz/e2e/check-ip-num
Browse files Browse the repository at this point in the history
Add ip number check in R00008
  • Loading branch information
weizhoublue authored Jan 29, 2024
2 parents 65006b8 + 99cffc9 commit 4d60470
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/e2e/reliability/reliability_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("IP Allocation", Label("Reliability_IP"), func() {

BeforeEach(func() {
ctx = context.Background()
IPNum = 100
IPNum = 50
extraNum = 20

// create EgressGateway and pods
Expand Down Expand Up @@ -109,6 +109,17 @@ var _ = Describe("IP Allocation", Label("Reliability_IP"), func() {
Expect(err).NotTo(HaveOccurred())
creationTime := time.Since(creationStart)

// check egessgateway ip number
if egressConfig.EnableIPv4 {
Expect(egw.Status.IPUsage.IPv4Free).To(BeZero())
Expect(egw.Status.IPUsage.IPv4Total).To(Equal(int(IPNum)))
}

if egressConfig.EnableIPv6 {
Expect(egw.Status.IPUsage.IPv6Free).To(BeZero())
Expect(egw.Status.IPUsage.IPv6Total).To(Equal(int(IPNum)))
}

// check eip
By("check eip of pods")
Expect(common.CheckPodsEgressIP(ctx, config, p2p, egressConfig.EnableIPv4, egressConfig.EnableIPv6, true)).NotTo(HaveOccurred(), "failed check eip")
Expand All @@ -130,6 +141,17 @@ var _ = Describe("IP Allocation", Label("Reliability_IP"), func() {
Expect(err).NotTo(HaveOccurred())
deletionTime := time.Since(deletionStart)

// check egessgateway ip number
if egressConfig.EnableIPv4 {
Expect(egw.Status.IPUsage.IPv4Free).To(Equal(int(IPNum)))
Expect(egw.Status.IPUsage.IPv4Total).To(Equal(int(IPNum)))
}

if egressConfig.EnableIPv6 {
Expect(egw.Status.IPUsage.IPv6Free).To(Equal(int(IPNum)))
Expect(egw.Status.IPUsage.IPv6Total).To(Equal(int(IPNum)))
}

By("check eip of pods")
Expect(common.CheckPodsEgressIP(ctx, config, p2p, egressConfig.EnableIPv4, egressConfig.EnableIPv6, false)).NotTo(HaveOccurred(), "failed check eip")
Expect(err).NotTo(HaveOccurred())
Expand Down

1 comment on commit 4d60470

@weizhoublue
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.