Hit ILB endpoint in ILB e2e test
This commit is contained in:
		| @@ -1433,9 +1433,37 @@ var _ = SIGDescribe("Services", func() { | ||||
| 		svc = jig.WaitForLoadBalancerOrFail(namespace, serviceName, createTimeout) | ||||
| 		jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer) | ||||
| 		lbIngress := &svc.Status.LoadBalancer.Ingress[0] | ||||
| 		svcPort := int(svc.Spec.Ports[0].Port) | ||||
| 		// should have an internal IP. | ||||
| 		Expect(isInternalEndpoint(lbIngress)).To(BeTrue()) | ||||
|  | ||||
| 		// ILBs are not accessible from the test orchestrator, so it's necessary to use | ||||
| 		//  a pod to test the service. | ||||
| 		By("hitting the internal load balancer from pod") | ||||
| 		framework.Logf("creating pod with host network") | ||||
| 		hostExec := framework.LaunchHostExecPod(f.ClientSet, f.Namespace.Name, "ilb-host-exec") | ||||
|  | ||||
| 		framework.Logf("Waiting up to %v for service %q's internal LB to respond to requests", createTimeout, serviceName) | ||||
| 		tcpIngressIP := framework.GetIngressPoint(lbIngress) | ||||
| 		if pollErr := wait.PollImmediate(pollInterval, createTimeout, func() (bool, error) { | ||||
| 			cmd := fmt.Sprintf(`curl -m 5 'http://%v:%v/echo?msg=hello'`, tcpIngressIP, svcPort) | ||||
| 			stdout, err := framework.RunHostCmd(hostExec.Namespace, hostExec.Name, cmd) | ||||
| 			if err != nil { | ||||
| 				framework.Logf("error curling; stdout: %v. err: %v", stdout, err) | ||||
| 				return false, nil | ||||
| 			} | ||||
|  | ||||
| 			if !strings.Contains(stdout, "hello") { | ||||
| 				framework.Logf("Expected output to contain 'hello', got %q; retrying...", stdout) | ||||
| 				return false, nil | ||||
| 			} | ||||
|  | ||||
| 			framework.Logf("Successful curl; stdout: %v", stdout) | ||||
| 			return true, nil | ||||
| 		}); pollErr != nil { | ||||
| 			framework.Failf("Failed to hit ILB IP, err: %v", pollErr) | ||||
| 		} | ||||
|  | ||||
| 		By("switching to external type LoadBalancer") | ||||
| 		svc = jig.UpdateServiceOrFail(namespace, serviceName, func(svc *v1.Service) { | ||||
| 			disableILB(svc) | ||||
| @@ -1455,6 +1483,11 @@ var _ = SIGDescribe("Services", func() { | ||||
| 		jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer) | ||||
| 		Expect(isInternalEndpoint(lbIngress)).To(BeFalse()) | ||||
|  | ||||
| 		By("hitting the external load balancer") | ||||
| 		framework.Logf("Waiting up to %v for service %q's external LB to respond to requests", createTimeout, serviceName) | ||||
| 		tcpIngressIP = framework.GetIngressPoint(lbIngress) | ||||
| 		jig.TestReachableHTTP(tcpIngressIP, svcPort, framework.LoadBalancerLagTimeoutDefault) | ||||
|  | ||||
| 		// GCE cannot test a specific IP because the test may not own it. This cloud specific condition | ||||
| 		// will be removed when GCP supports similar functionality. | ||||
| 		if framework.ProviderIs("azure") { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Nick Sardo
					Nick Sardo