From 2cb9f5d83d768041dd55370b53018357e6019017 Mon Sep 17 00:00:00 2001 From: Zihong Zheng Date: Fri, 23 Jun 2017 11:30:58 -0700 Subject: [PATCH] [esipp-e2e] Change service port to avoid collision --- test/e2e/service.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/e2e/service.go b/test/e2e/service.go index 2165e43e039..bf61ff3415d 100644 --- a/test/e2e/service.go +++ b/test/e2e/service.go @@ -1411,7 +1411,16 @@ var _ = framework.KubeDescribe("ESIPP [Slow]", func() { jig := framework.NewServiceTestJig(cs, serviceName) nodes := jig.GetNodes(framework.MaxNodesForEndpointsTests) - svc := jig.CreateOnlyLocalLoadBalancerService(namespace, serviceName, loadBalancerCreateTimeout, false, nil) + svc := jig.CreateOnlyLocalLoadBalancerService(namespace, serviceName, loadBalancerCreateTimeout, false, + func(svc *v1.Service) { + // Change service port to avoid collision with opened hostPorts + // in other tests that run in parallel. + if len(svc.Spec.Ports) != 0 { + svc.Spec.Ports[0].TargetPort = intstr.FromInt(int(svc.Spec.Ports[0].Port)) + svc.Spec.Ports[0].Port = 8081 + } + + }) serviceLBNames = append(serviceLBNames, cloudprovider.GetLoadBalancerName(svc)) defer func() { jig.ChangeServiceType(svc.Namespace, svc.Name, v1.ServiceTypeClusterIP, loadBalancerCreateTimeout)