From be1ed2f43a263912bba425ea53191a76001ebdce Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Wed, 11 Nov 2020 10:13:34 +0100 Subject: [PATCH] use uncommon ports for e2e network test since we added tests to check connectivity against pods with hostNetwork: true, there is the possibility that those pods fail to run because the port is being used in the host. Current test were using port 8080,8081 and 8082 that are commonly used in hosts for other applications. If the service is not ready after a certain time, and we are using Pods with hostNetwork: true we assume that there is a conflict and skip this test. --- test/e2e/framework/network/utils.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/e2e/framework/network/utils.go b/test/e2e/framework/network/utils.go index 37d74d737bc..338604c271e 100644 --- a/test/e2e/framework/network/utils.go +++ b/test/e2e/framework/network/utils.go @@ -699,6 +699,13 @@ func (config *NetworkingTestConfig) CreateService(serviceSpec *v1.Service) *v1.S framework.ExpectNoError(err, fmt.Sprintf("Failed to create %s service: %v", serviceSpec.Name, err)) err = WaitForService(config.f.ClientSet, config.Namespace, serviceSpec.Name, true, 5*time.Second, 45*time.Second) + // If the endpoints of the service use HostNetwork: true, they are going to try to bind on the host namespace + // if those ports are in use by any process in the host, the endpoints pods will fail to be deployed + // and the service will never be ready. We can be smarter and check directly that the ports are free + // but by now we Skip the test if the service is not ready and we are using endpoints with host network + if config.EndpointsHostNetwork && err != nil { + e2eskipper.Skipf("Service not ready. Pods are using hostNetwork: true, please check there is no other process on the host using the same ports: %v", err) + } framework.ExpectNoError(err, fmt.Sprintf("error while waiting for service:%s err: %v", serviceSpec.Name, err)) createdService, err := config.getServiceClient().Get(context.TODO(), serviceSpec.Name, metav1.GetOptions{})