Skip to content

Commit

Permalink
test/k8s: for services test, wait for all applied manifests to delete
Browse files Browse the repository at this point in the history
In the K8sDatapathConfig tests "echo-svc" deployment Pods are failing to terminate while waiting to terminate all Pods.
These come from a deployment, that shouldn't be applied in this suite. Presumably failure to delete is being cause by the Deployment controller restarting the Pods as they're deleted.

To try to fix this, going to wait for applied yamls in K8sServices to be fully deleted, including finalizers.

Addresses: #25255

Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
  • Loading branch information
tommyp1ckles committed May 11, 2023
1 parent 23f4d04 commit 6878133
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/k8s/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"net"
"strings"
"sync"
"time"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -89,9 +90,19 @@ var _ = SkipDescribeIf(helpers.RunsOn54Kernel, "K8sDatapathServicesTest", func()
})

AfterAll(func() {
wg := sync.WaitGroup{}
for _, yaml := range yamls {
kubectl.Delete(yaml)
wg.Add(1)
go func(yaml string) {
defer wg.Done()
// Ensure that all deployments are fully cleaned up before
// proceeding to the next test.
res := kubectl.DeleteAndWait(yaml, true)

Expect(res.WasSuccessful()).Should(BeTrue(), "Unable to cleanup yaml: %s", yaml)
}(yaml)
}
wg.Wait()
ExpectAllPodsTerminated(kubectl)
})

Expand Down

0 comments on commit 6878133

Please sign in to comment.