From ef74abd2b7683abb83d83f83962df369a549baa2 Mon Sep 17 00:00:00 2001 From: Alex Robinson Date: Tue, 13 Oct 2015 18:28:36 +0000 Subject: [PATCH] Add test that verifies a load balancer's IP doesn't change when its port is changed. --- test/e2e/service.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/e2e/service.go b/test/e2e/service.go index 9c0b2e0f1c..2fc6a3fb41 100644 --- a/test/e2e/service.go +++ b/test/e2e/service.go @@ -548,6 +548,16 @@ var _ = Describe("Services", func() { i++ } + By("updating service's port " + serviceName + " and reaching it at the same IP") + service, err = updateService(f.Client, f.Namespace.Name, serviceName, func(s *api.Service) { + s.Spec.Ports[0].Port = 19482 // chosen arbitrarily to not conflict with port 80 + }) + Expect(err).NotTo(HaveOccurred()) + port = service.Spec.Ports[0] + if !testLoadBalancerReachable(service.Status.LoadBalancer.Ingress[0], port.Port) { + Failf("Failed to reach load balancer at original ingress after updating its port: %+v", service) + } + By("changing service " + serviceName + " back to type=ClusterIP") service, err = updateService(f.Client, f.Namespace.Name, serviceName, func(s *api.Service) { s.Spec.Type = api.ServiceTypeClusterIP @@ -580,7 +590,7 @@ var _ = Describe("Services", func() { ip = pickNodeIP(f.Client) testNotReachable(ip, nodePort2) By("checking the LoadBalancer is closed") - testLoadBalancerNotReachable(ingress1, 80) + testLoadBalancerNotReachable(ingress1, port.Port) }) It("should prevent NodePort collisions", func() {