Skip to content

Commit

Permalink
e2e test: ensure pods are gone on test teardown
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Duarte Barroso <[email protected]>
  • Loading branch information
maiqueb committed May 16, 2023
1 parent 460671e commit 8e06025
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ var _ = Describe("Multus dynamic networks controller", func() {
})
}

isTestNamespaceEmpty := func() bool {
pods, err := clients.ListPods(namespace, appLabel(podName))
if err != nil {
return false
}
return len(pods.Items) == 0
}

Context("a provisioned pod having network selection elements", func() {
var pod *corev1.Pod

Expand Down Expand Up @@ -93,6 +101,7 @@ var _ = Describe("Multus dynamic networks controller", func() {

AfterEach(func() {
Expect(clients.DeletePod(pod)).To(Succeed())
Eventually(isTestNamespaceEmpty, timeout).Should(BeTrue())
})

It("manages to add a new interface to a running pod", func() {
Expand Down Expand Up @@ -190,6 +199,7 @@ var _ = Describe("Multus dynamic networks controller", func() {

AfterEach(func() {
Expect(clients.DeletePod(pod)).To(Succeed())
Eventually(isTestNamespaceEmpty, timeout).Should(BeTrue())
})

It("manages to add a new interface to a running pod", func() {
Expand Down Expand Up @@ -267,6 +277,7 @@ var _ = Describe("Multus dynamic networks controller", func() {

AfterEach(func() {
Expect(clients.DeletePod(pod)).To(Succeed())
Eventually(isTestNamespaceEmpty, timeout).Should(BeTrue())
})

runningPod := func() *corev1.Pod {
Expand Down

0 comments on commit 8e06025

Please sign in to comment.