mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
e2e: use framework.ExpectEqual() for test/e2e/network
This commit is contained in:
parent
e12f96adc6
commit
5234f2e668
@ -549,7 +549,7 @@ func assertFilesContain(fileNames []string, fileDir string, pod *v1.Pod, client
|
|||||||
e2elog.Logf("Lookups using %s/%s failed for: %v\n", pod.Namespace, pod.Name, failed)
|
e2elog.Logf("Lookups using %s/%s failed for: %v\n", pod.Namespace, pod.Name, failed)
|
||||||
return false, nil
|
return false, nil
|
||||||
}))
|
}))
|
||||||
gomega.Expect(len(failed)).To(gomega.Equal(0))
|
framework.ExpectEqual(len(failed), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateDNSResults(f *framework.Framework, pod *v1.Pod, fileNames []string) {
|
func validateDNSResults(f *framework.Framework, pod *v1.Pod, fileNames []string) {
|
||||||
|
@ -41,7 +41,6 @@ import (
|
|||||||
"k8s.io/kubernetes/test/e2e/framework/providers/gce"
|
"k8s.io/kubernetes/test/e2e/framework/providers/gce"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -341,7 +340,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
|
|||||||
|
|
||||||
// ClusterIP ServicePorts have no NodePort
|
// ClusterIP ServicePorts have no NodePort
|
||||||
for _, sp := range svcPorts {
|
for _, sp := range svcPorts {
|
||||||
gomega.Expect(sp.NodePort).To(gomega.Equal(int32(0)))
|
framework.ExpectEqual(sp.NodePort, int32(0))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ import (
|
|||||||
gcecloud "k8s.io/legacy-cloud-providers/gce"
|
gcecloud "k8s.io/legacy-cloud-providers/gce"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("Services [Feature:GCEAlphaFeature][Slow]", func() {
|
var _ = SIGDescribe("Services [Feature:GCEAlphaFeature][Slow]", func() {
|
||||||
@ -80,7 +79,7 @@ var _ = SIGDescribe("Services [Feature:GCEAlphaFeature][Slow]", func() {
|
|||||||
// Verify that service has been updated properly.
|
// Verify that service has been updated properly.
|
||||||
svcTier, err := gcecloud.GetServiceNetworkTier(svc)
|
svcTier, err := gcecloud.GetServiceNetworkTier(svc)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
gomega.Expect(svcTier).To(gomega.Equal(cloud.NetworkTierStandard))
|
framework.ExpectEqual(svcTier, cloud.NetworkTierStandard)
|
||||||
// Record the LB name for test cleanup.
|
// Record the LB name for test cleanup.
|
||||||
serviceLBNames = append(serviceLBNames, cloudprovider.DefaultLoadBalancerName(svc))
|
serviceLBNames = append(serviceLBNames, cloudprovider.DefaultLoadBalancerName(svc))
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ var _ = SIGDescribe("Services [Feature:GCEAlphaFeature][Slow]", func() {
|
|||||||
// Verify that service has been updated properly.
|
// Verify that service has been updated properly.
|
||||||
svcTier, err = gcecloud.GetServiceNetworkTier(svc)
|
svcTier, err = gcecloud.GetServiceNetworkTier(svc)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
gomega.Expect(svcTier).To(gomega.Equal(cloud.NetworkTierDefault))
|
framework.ExpectEqual(svcTier, cloud.NetworkTierDefault)
|
||||||
|
|
||||||
// Wait until the ingress IP changes. Each tier has its own pool of
|
// Wait until the ingress IP changes. Each tier has its own pool of
|
||||||
// IPs, so changing tiers implies changing IPs.
|
// IPs, so changing tiers implies changing IPs.
|
||||||
@ -125,10 +124,10 @@ var _ = SIGDescribe("Services [Feature:GCEAlphaFeature][Slow]", func() {
|
|||||||
setNetworkTier(svc, string(gcecloud.NetworkTierAnnotationStandard))
|
setNetworkTier(svc, string(gcecloud.NetworkTierAnnotationStandard))
|
||||||
})
|
})
|
||||||
// Verify that service has been updated properly.
|
// Verify that service has been updated properly.
|
||||||
gomega.Expect(svc.Spec.LoadBalancerIP).To(gomega.Equal(requestedIP))
|
framework.ExpectEqual(svc.Spec.LoadBalancerIP, requestedIP)
|
||||||
svcTier, err = gcecloud.GetServiceNetworkTier(svc)
|
svcTier, err = gcecloud.GetServiceNetworkTier(svc)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
gomega.Expect(svcTier).To(gomega.Equal(cloud.NetworkTierStandard))
|
framework.ExpectEqual(svcTier, cloud.NetworkTierStandard)
|
||||||
|
|
||||||
// Wait until the ingress IP changes and verifies the LB.
|
// Wait until the ingress IP changes and verifies the LB.
|
||||||
ingressIP = waitAndVerifyLBWithTier(jig, ns, svcName, ingressIP, createTimeout, lagTimeout)
|
ingressIP = waitAndVerifyLBWithTier(jig, ns, svcName, ingressIP, createTimeout, lagTimeout)
|
||||||
@ -153,7 +152,7 @@ func waitAndVerifyLBWithTier(jig *framework.ServiceTestJig, ns, svcName, existin
|
|||||||
ginkgo.By("running sanity and reachability checks")
|
ginkgo.By("running sanity and reachability checks")
|
||||||
if svc.Spec.LoadBalancerIP != "" {
|
if svc.Spec.LoadBalancerIP != "" {
|
||||||
// Verify that the new ingress IP is the requested IP if it's set.
|
// Verify that the new ingress IP is the requested IP if it's set.
|
||||||
gomega.Expect(ingressIP).To(gomega.Equal(svc.Spec.LoadBalancerIP))
|
framework.ExpectEqual(ingressIP, svc.Spec.LoadBalancerIP)
|
||||||
}
|
}
|
||||||
jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer)
|
jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer)
|
||||||
// If the IP has been used by previous test, sometimes we get the lingering
|
// If the IP has been used by previous test, sometimes we get the lingering
|
||||||
@ -166,7 +165,7 @@ func waitAndVerifyLBWithTier(jig *framework.ServiceTestJig, ns, svcName, existin
|
|||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
netTier, err := getLBNetworkTierByIP(ingressIP)
|
netTier, err := getLBNetworkTierByIP(ingressIP)
|
||||||
framework.ExpectNoError(err, "failed to get the network tier of the load balancer")
|
framework.ExpectNoError(err, "failed to get the network tier of the load balancer")
|
||||||
gomega.Expect(netTier).To(gomega.Equal(svcNetTier))
|
framework.ExpectEqual(netTier, svcNetTier)
|
||||||
|
|
||||||
return ingressIP
|
return ingressIP
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ func nodeProxyTest(f *framework.Framework, prefix, nodeDest string) {
|
|||||||
serviceUnavailableErrors++
|
serviceUnavailableErrors++
|
||||||
} else {
|
} else {
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
gomega.Expect(status).To(gomega.Equal(http.StatusOK))
|
framework.ExpectEqual(status, http.StatusOK)
|
||||||
gomega.Expect(d).To(gomega.BeNumerically("<", proxyHTTPCallTimeout))
|
gomega.Expect(d).To(gomega.BeNumerically("<", proxyHTTPCallTimeout))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,12 +317,12 @@ var _ = SIGDescribe("Services", func() {
|
|||||||
ginkgo.By("Retrieve sourceip from a pod on the same node")
|
ginkgo.By("Retrieve sourceip from a pod on the same node")
|
||||||
sourceIP1, execPodIP1 := execSourceipTest(f, cs, ns, node1.Name, serviceIP, servicePort)
|
sourceIP1, execPodIP1 := execSourceipTest(f, cs, ns, node1.Name, serviceIP, servicePort)
|
||||||
ginkgo.By("Verifying the preserved source ip")
|
ginkgo.By("Verifying the preserved source ip")
|
||||||
gomega.Expect(sourceIP1).To(gomega.Equal(execPodIP1))
|
framework.ExpectEqual(sourceIP1, execPodIP1)
|
||||||
|
|
||||||
ginkgo.By("Retrieve sourceip from a pod on a different node")
|
ginkgo.By("Retrieve sourceip from a pod on a different node")
|
||||||
sourceIP2, execPodIP2 := execSourceipTest(f, cs, ns, node2.Name, serviceIP, servicePort)
|
sourceIP2, execPodIP2 := execSourceipTest(f, cs, ns, node2.Name, serviceIP, servicePort)
|
||||||
ginkgo.By("Verifying the preserved source ip")
|
ginkgo.By("Verifying the preserved source ip")
|
||||||
gomega.Expect(sourceIP2).To(gomega.Equal(execPodIP2))
|
framework.ExpectEqual(sourceIP2, execPodIP2)
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should be able to up and down services", func() {
|
ginkgo.It("should be able to up and down services", func() {
|
||||||
@ -1598,7 +1598,7 @@ var _ = SIGDescribe("Services", func() {
|
|||||||
}
|
}
|
||||||
// should have the given static internal IP.
|
// should have the given static internal IP.
|
||||||
jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer)
|
jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer)
|
||||||
gomega.Expect(framework.GetIngressPoint(lbIngress)).To(gomega.Equal(internalStaticIP))
|
framework.ExpectEqual(framework.GetIngressPoint(lbIngress), internalStaticIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
ginkgo.By("switching to ClusterIP type to destroy loadbalancer")
|
ginkgo.By("switching to ClusterIP type to destroy loadbalancer")
|
||||||
@ -1648,7 +1648,7 @@ var _ = SIGDescribe("Services", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("gceCloud.GetHttpHealthCheck(%q) = _, %v; want nil", hcName, err)
|
e2elog.Failf("gceCloud.GetHttpHealthCheck(%q) = _, %v; want nil", hcName, err)
|
||||||
}
|
}
|
||||||
gomega.Expect(hc.CheckIntervalSec).To(gomega.Equal(gceHcCheckIntervalSeconds))
|
framework.ExpectEqual(hc.CheckIntervalSec, gceHcCheckIntervalSeconds)
|
||||||
|
|
||||||
ginkgo.By("modify the health check interval")
|
ginkgo.By("modify the health check interval")
|
||||||
hc.CheckIntervalSec = gceHcCheckIntervalSeconds - 1
|
hc.CheckIntervalSec = gceHcCheckIntervalSeconds - 1
|
||||||
|
Loading…
Reference in New Issue
Block a user