[esipp-e2e] Change service port to avoid collision

This commit is contained in:
Zihong Zheng 2017-06-23 11:30:58 -07:00
parent e123311d8a
commit 2cb9f5d83d

View File

@ -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)