Skip to content

Commit

Permalink
EIP e2es: for host network pods, block until fully deleted
Browse files Browse the repository at this point in the history
Because on subsequent runs, another host net test pod may
attempt to bind to the same port.

Signed-off-by: Martin Kennelly <[email protected]>
  • Loading branch information
martinkennelly committed Dec 18, 2024
1 parent 19931e2 commit 5e6160d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/e2e/egressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"sort"
"strconv"
"strings"
"time"

"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util"
Expand Down Expand Up @@ -980,11 +981,21 @@ spec:
}

ginkgo.By("2. Creating host-networked pod, on non-egress node acting as \"another node\"")
_, err = createPod(f, egress2Node.name+"-host-net-pod", egress2Node.name, f.Namespace.Name, []string{}, map[string]string{}, func(p *corev1.Pod) {
hostNetPodName := egress2Node.name + "-host-net-pod"
p, err := createPod(f, hostNetPodName, egress2Node.name, f.Namespace.Name, []string{}, map[string]string{}, func(p *corev1.Pod) {
p.Spec.HostNetwork = true
p.Spec.Containers[0].Image = "docker.io/httpd"
})
framework.ExpectNoError(err)
// block until host network pod is fully deleted because subsequent tests that require binding to the same port may fail
defer func() {
ctxWithTimeout, cancelFn := context.WithTimeout(context.Background(), time.Second*60)
defer cancelFn()
err = pod.DeletePodWithWait(ctxWithTimeout, f.ClientSet, p)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred(), "deletion of host network pod must succeed")
err = pod.WaitForPodNotFoundInNamespace(ctxWithTimeout, f.ClientSet, hostNetPodName, f.Namespace.Name, time.Second*59)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred(), "pod must be fully deleted within 60 seconds")
}()
hostNetPod := node{
name: egress2Node.name + "-host-net-pod",
nodeIP: egress2Node.nodeIP,
Expand Down

0 comments on commit 5e6160d

Please sign in to comment.