Skip to content

Commit

Permalink
Merge pull request #1153 from spidernet-io/bz/e2e/fix/S00001
Browse files Browse the repository at this point in the history
cancel to delete egressEndpointSlice manually in case S00001
  • Loading branch information
bzsuni authored Jan 24, 2024
2 parents 08bbcd0 + bc9ca85 commit 9030091
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions test/e2e/egressendpointslice/egressendpointslice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var _ = Describe("Egressendpointslice", func() {
// create deploy
deployName := "deploy-" + uuid.NewString()
deploy, err = common.CreateDeploy(ctx, cli, deployName, config.Image, podNum, time.Second*20)
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create daemonset %s\n", deployName))
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create deploy %s\n", deployName))
GinkgoWriter.Printf("succeeded to create deploy %s\n", deploy.Name)

// create policy
Expand All @@ -105,9 +105,9 @@ var _ = Describe("Egressendpointslice", func() {
err := common.WaitDeployDeleted(ctx, cli, deploy, time.Second*10)
Expect(err).NotTo(HaveOccurred())

// create deploy agen
// create deploy again
deploy, err = common.CreateDeploy(ctx, cli, deployName, config.Image, podNum, time.Second*20)
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create daemonset %s\n", deployName))
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create deploy %s\n", deployName))
GinkgoWriter.Printf("succeeded to create deploy %s\n", deploy.Name)

// check egressEndpointSlice synced
Expand All @@ -123,18 +123,18 @@ var _ = Describe("Egressendpointslice", func() {
// delete the deploy, and we expect the egressEndpointSlice to be deleted as well
err = common.WaitDeployDeleted(ctx, cli, deploy, time.Second*10)
Expect(err).NotTo(HaveOccurred())
ees, err := common.GetEgressEndPointSliceByEgressPolicy(ctx, cli, egp)
Expect(err).NotTo(HaveOccurred())
if ees != nil {
Expect(common.WaitEgressEndPointSliceDeleted(ctx, cli, ees, time.Minute)).NotTo(HaveOccurred())
}

Eventually(ctx, func() string {
ees, _ := common.GetEgressEndPointSliceByEgressPolicy(ctx, cli, egp)
return ees.Name
}).WithTimeout(time.Second * 10).WithPolling(time.Second * 2).Should(BeEmpty())
})

It("test the cluster-level policy", func() {
// create deploy
deployName := "deploy-" + uuid.NewString()
deploy, err = common.CreateDeploy(ctx, cli, deployName, config.Image, podNum, time.Second*20)
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create daemonset %s\n", deployName))
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create deploy %s\n", deployName))
GinkgoWriter.Printf("succeeded to create deploy %s\n", deploy.Name)

// create cluster policy
Expand All @@ -148,7 +148,7 @@ var _ = Describe("Egressendpointslice", func() {

// create deploy again
deploy, err = common.CreateDeploy(ctx, cli, deployName, config.Image, podNum, time.Second*20)
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create daemonset %s\n", deployName))
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed to create deploy %s\n", deployName))
GinkgoWriter.Printf("succeeded to create deploy %s\n", deploy.Name)

// check egressClusterEndpointSlice synced
Expand All @@ -164,11 +164,10 @@ var _ = Describe("Egressendpointslice", func() {
// delete the deploy, and we expect the egressClusterEndpointSlice to be deleted as well
err = common.WaitDeployDeleted(ctx, cli, deploy, time.Second*10)
Expect(err).NotTo(HaveOccurred())
eces, err := common.GetEgressClusterEndPointSliceByEgressClusterPolicy(ctx, cli, egcp)
Expect(err).NotTo(HaveOccurred())
if eces != nil {
Expect(common.WaitEgressClusterEndPointSliceDeleted(ctx, cli, eces, time.Minute)).NotTo(HaveOccurred())
}
Eventually(ctx, func() string {
eces, _ := common.GetEgressClusterEndPointSliceByEgressClusterPolicy(ctx, cli, egcp)
return eces.Name
}).WithTimeout(time.Second * 10).WithPolling(time.Second * 2).Should(BeEmpty())
})
})
})

0 comments on commit 9030091

Please sign in to comment.