e2e test with hostNetwork pods can't run in parallel

the tests with pods using hostNetwork need to bind pods for the
test. Since they use hostNetwork the ports are limited, hence, if
more than one run in parallel, one is going to fail because will not
be able to get the port.
This commit is contained in:
Antonio Ojea 2021-04-07 20:07:18 +02:00
parent efad544195
commit 7c7d003e5c

View File

@ -468,21 +468,6 @@ var _ = common.SIGDescribe("Networking", func() {
}
})
ginkgo.It("should function for pod-Service(hostNetwork): udp", func() {
config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.EndpointsUseHostNetwork)
ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterUDPPort))
err := config.DialFromTestContainer("udp", config.ClusterIP, e2enetwork.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
if err != nil {
framework.Failf("failed dialing endpoint, %v", err)
}
ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeUDPPort))
err = config.DialFromTestContainer("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
if err != nil {
framework.Failf("failed dialing endpoint, %v", err)
}
})
// if the endpoints pods use hostNetwork, several tests can't run in parallel
// because the pods will try to acquire the same port in the host.
// We run the test in serial, to avoid port conflicts.
@ -502,6 +487,20 @@ var _ = common.SIGDescribe("Networking", func() {
framework.Failf("failed dialing endpoint, %v", err)
}
ginkgo.By("pod-Service(hostNetwork): udp")
ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterUDPPort))
err = config.DialFromTestContainer("udp", config.ClusterIP, e2enetwork.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
if err != nil {
framework.Failf("failed dialing endpoint, %v", err)
}
ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeUDPPort))
err = config.DialFromTestContainer("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
if err != nil {
framework.Failf("failed dialing endpoint, %v", err)
}
ginkgo.By("node-Service(hostNetwork): http")
ginkgo.By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, e2enetwork.ClusterHTTPPort))