diff --git a/test/e2e/network/proxy.go b/test/e2e/network/proxy.go index 05ad256d1b2..ab19085c465 100644 --- a/test/e2e/network/proxy.go +++ b/test/e2e/network/proxy.go @@ -312,14 +312,14 @@ func nodeProxyTest(f *framework.Framework, prefix, nodeDest string) { } else { framework.ExpectNoError(err) framework.ExpectEqual(status, http.StatusOK) - gomega.Expect(d).To(gomega.BeNumerically("<", proxyHTTPCallTimeout)) + framework.ExpectEqual(d, gomega.BeNumerically("<", proxyHTTPCallTimeout)) } } if serviceUnavailableErrors > 0 { e2elog.Logf("error: %d requests to proxy node logs failed", serviceUnavailableErrors) } maxFailures := int(math.Floor(0.1 * float64(proxyAttempts))) - gomega.Expect(serviceUnavailableErrors).To(gomega.BeNumerically("<", maxFailures)) + framework.ExpectEqual(serviceUnavailableErrors, gomega.BeNumerically("<", maxFailures)) } // waitForEndpoint waits for the specified endpoint to be ready. diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index 44d040697ac..4aebcc53377 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -1239,7 +1239,7 @@ var _ = SIGDescribe("Services", func() { e2elog.Failf("Created service with conflicting NodePort: %v", result2) } expectedErr := fmt.Sprintf("%d.*port is already allocated", port.NodePort) - gomega.Expect(fmt.Sprintf("%v", err)).To(gomega.MatchRegexp(expectedErr)) + framework.ExpectEqual(fmt.Sprintf("%v", err), gomega.MatchRegexp(expectedErr)) ginkgo.By("deleting service " + serviceName1 + " to release NodePort") err = t.DeleteService(serviceName1) @@ -1300,7 +1300,7 @@ var _ = SIGDescribe("Services", func() { e2elog.Failf("failed to prevent update of service with out-of-range NodePort: %v", result) } expectedErr := fmt.Sprintf("%d.*port is not in the valid range", outOfRangeNodePort) - gomega.Expect(fmt.Sprintf("%v", err)).To(gomega.MatchRegexp(expectedErr)) + framework.ExpectEqual(fmt.Sprintf("%v", err), gomega.MatchRegexp(expectedErr)) ginkgo.By("deleting original service " + serviceName) err = t.DeleteService(serviceName) @@ -1314,7 +1314,7 @@ var _ = SIGDescribe("Services", func() { if err == nil { e2elog.Failf("failed to prevent create of service with out-of-range NodePort (%d): %v", outOfRangeNodePort, service) } - gomega.Expect(fmt.Sprintf("%v", err)).To(gomega.MatchRegexp(expectedErr)) + framework.ExpectEqual(fmt.Sprintf("%v", err), gomega.MatchRegexp(expectedErr)) }) ginkgo.It("should release NodePorts on delete", func() { @@ -1648,7 +1648,7 @@ var _ = SIGDescribe("Services", func() { lbIngress := &svc.Status.LoadBalancer.Ingress[0] svcPort := int(svc.Spec.Ports[0].Port) // should have an internal IP. - gomega.Expect(isInternalEndpoint(lbIngress)).To(gomega.BeTrue()) + framework.ExpectEqual(isInternalEndpoint(lbIngress), gomega.BeTrue()) // ILBs are not accessible from the test orchestrator, so it's necessary to use // a pod to test the service. @@ -1694,7 +1694,7 @@ var _ = SIGDescribe("Services", func() { } // should have an external IP. jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer) - gomega.Expect(isInternalEndpoint(lbIngress)).To(gomega.BeFalse()) + framework.ExpectEqual(isInternalEndpoint(lbIngress), gomega.BeFalse()) ginkgo.By("hitting the external load balancer") e2elog.Logf("Waiting up to %v for service %q's external LB to respond to requests", createTimeout, serviceName) @@ -2465,7 +2465,7 @@ func execAffinityTestForNonLBServiceWithOptionalTransition(f *framework.Framewor if serviceType == v1.ServiceTypeNodePort { nodes := framework.GetReadySchedulableNodesOrDie(cs) addrs := e2enode.CollectAddresses(nodes, v1.NodeInternalIP) - gomega.Expect(len(addrs)).To(gomega.BeNumerically(">", 0), "ginkgo.Failed to get Node internal IP") + framework.ExpectEqual(len(addrs), gomega.BeNumerically(">", 0), "ginkgo.Failed to get Node internal IP") svcIP = addrs[0] servicePort = int(svc.Spec.Ports[0].NodePort) } else { @@ -2482,17 +2482,17 @@ func execAffinityTestForNonLBServiceWithOptionalTransition(f *framework.Framewor framework.ExpectNoError(err, "failed to fetch pod: %s in namespace: %s", execPod.Name, ns) if !isTransitionTest { - gomega.Expect(e2eservice.CheckAffinity(execPod, svcIP, servicePort, true)).To(gomega.BeTrue()) + framework.ExpectEqual(e2eservice.CheckAffinity(execPod, svcIP, servicePort, true), gomega.BeTrue()) } if isTransitionTest { svc = jig.UpdateServiceOrFail(svc.Namespace, svc.Name, func(svc *v1.Service) { svc.Spec.SessionAffinity = v1.ServiceAffinityNone }) - gomega.Expect(e2eservice.CheckAffinity(execPod, svcIP, servicePort, false)).To(gomega.BeTrue()) + framework.ExpectEqual(e2eservice.CheckAffinity(execPod, svcIP, servicePort, false), gomega.BeTrue()) svc = jig.UpdateServiceOrFail(svc.Namespace, svc.Name, func(svc *v1.Service) { svc.Spec.SessionAffinity = v1.ServiceAffinityClientIP }) - gomega.Expect(e2eservice.CheckAffinity(execPod, svcIP, servicePort, true)).To(gomega.BeTrue()) + framework.ExpectEqual(e2eservice.CheckAffinity(execPod, svcIP, servicePort, true), gomega.BeTrue()) } } @@ -2530,17 +2530,17 @@ func execAffinityTestForLBServiceWithOptionalTransition(f *framework.Framework, port := int(svc.Spec.Ports[0].Port) if !isTransitionTest { - gomega.Expect(e2eservice.CheckAffinity(nil, ingressIP, port, true)).To(gomega.BeTrue()) + framework.ExpectEqual(e2eservice.CheckAffinity(nil, ingressIP, port, true), gomega.BeTrue()) } if isTransitionTest { svc = jig.UpdateServiceOrFail(svc.Namespace, svc.Name, func(svc *v1.Service) { svc.Spec.SessionAffinity = v1.ServiceAffinityNone }) - gomega.Expect(e2eservice.CheckAffinity(nil, ingressIP, port, false)).To(gomega.BeTrue()) + framework.ExpectEqual(e2eservice.CheckAffinity(nil, ingressIP, port, false), gomega.BeTrue()) svc = jig.UpdateServiceOrFail(svc.Namespace, svc.Name, func(svc *v1.Service) { svc.Spec.SessionAffinity = v1.ServiceAffinityClientIP }) - gomega.Expect(e2eservice.CheckAffinity(nil, ingressIP, port, true)).To(gomega.BeTrue()) + framework.ExpectEqual(e2eservice.CheckAffinity(nil, ingressIP, port, true), gomega.BeTrue()) } }