Skip to content

Commit

Permalink
test: fix race condition of deleting ccnp in e2e test
Browse files Browse the repository at this point in the history
There is a flake in e2e test when a test case starts to proceed
before ccnp comes to take effect by cilium-agent. The correct way to
delete ccnp is to run "kubectl delete" followed by "cilium policy wait",
and kubectl helper already has such wrappers.

Fixes: #24380

Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
  • Loading branch information
jschwinger233 authored and julianwiedmann committed Mar 30, 2023
1 parent 816f3ca commit 22a3743
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/k8s/datapath_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,6 @@ var _ = Describe("K8sDatapathConfig", func() {
kubectl.Exec("kubectl label nodes --all status-")
})

AfterEach(func() {
kubectl.Exec(fmt.Sprintf("%s delete --all ccnp", helpers.KubectlCmd))
})

SkipItIf(func() bool {
return !helpers.IsIntegration(helpers.CIIntegrationGKE)
}, "Check connectivity with IPv6 disabled", func() {
Expand Down Expand Up @@ -528,6 +524,10 @@ func testHostFirewall(kubectl *helpers.Kubectl) {
By(fmt.Sprintf("Applying policies %s", demoHostPolicies))
_, err := kubectl.CiliumClusterwidePolicyAction(demoHostPolicies, helpers.KubectlApply, helpers.HelperTimeout)
ExpectWithOffset(1, err).Should(BeNil(), fmt.Sprintf("Error creating resource %s: %s", demoHostPolicies, err))
defer func() {
_, err := kubectl.CiliumClusterwidePolicyAction(demoHostPolicies, helpers.KubectlDelete, helpers.HelperTimeout)
ExpectWithOffset(1, err).Should(BeNil(), fmt.Sprintf("Error deleting resource %s: %s", demoHostPolicies, err))
}()

var wg sync.WaitGroup
wg.Add(1)
Expand Down

0 comments on commit 22a3743

Please sign in to comment.