mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
[e2e] Make meaningful service name in test
This commit is contained in:
parent
d1e828f8df
commit
a4de66027f
@ -333,12 +333,16 @@ var _ = SIGDescribe("Services", func() {
|
||||
ns := f.Namespace.Name
|
||||
numPods, servicePort := 3, defaultServeHostnameServicePort
|
||||
|
||||
ginkgo.By("creating service1 in namespace " + ns)
|
||||
podNames1, svc1IP, err := framework.StartServeHostnameService(cs, getServeHostnameService("service1"), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc1IP, ns)
|
||||
ginkgo.By("creating service2 in namespace " + ns)
|
||||
podNames2, svc2IP, err := framework.StartServeHostnameService(cs, getServeHostnameService("service2"), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc2IP, ns)
|
||||
svc1 := "up-down-1"
|
||||
svc2 := "up-down-2"
|
||||
svc3 := "up-down-3"
|
||||
|
||||
ginkgo.By("creating " + svc1 + " in namespace " + ns)
|
||||
podNames1, svc1IP, err := framework.StartServeHostnameService(cs, getServeHostnameService(svc1), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc1, ns)
|
||||
ginkgo.By("creating " + svc2 + " in namespace " + ns)
|
||||
podNames2, svc2IP, err := framework.StartServeHostnameService(cs, getServeHostnameService(svc2), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc2, ns)
|
||||
|
||||
hosts, err := e2essh.NodeSSHHosts(cs)
|
||||
framework.ExpectNoError(err, "failed to find external/internal IPs for every node")
|
||||
@ -347,34 +351,34 @@ var _ = SIGDescribe("Services", func() {
|
||||
}
|
||||
host := hosts[0]
|
||||
|
||||
ginkgo.By("verifying service1 is up")
|
||||
ginkgo.By("verifying service " + svc1 + " is up")
|
||||
framework.ExpectNoError(framework.VerifyServeHostnameServiceUp(cs, ns, host, podNames1, svc1IP, servicePort))
|
||||
|
||||
ginkgo.By("verifying service2 is up")
|
||||
ginkgo.By("verifying service " + svc2 + " is up")
|
||||
framework.ExpectNoError(framework.VerifyServeHostnameServiceUp(cs, ns, host, podNames2, svc2IP, servicePort))
|
||||
|
||||
// Stop service 1 and make sure it is gone.
|
||||
ginkgo.By("stopping service1")
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, "service1"))
|
||||
ginkgo.By("stopping service " + svc1)
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, svc1))
|
||||
|
||||
ginkgo.By("verifying service1 is not up")
|
||||
ginkgo.By("verifying service " + svc1 + " is not up")
|
||||
framework.ExpectNoError(framework.VerifyServeHostnameServiceDown(cs, host, svc1IP, servicePort))
|
||||
ginkgo.By("verifying service2 is still up")
|
||||
ginkgo.By("verifying service " + svc2 + " is still up")
|
||||
framework.ExpectNoError(framework.VerifyServeHostnameServiceUp(cs, ns, host, podNames2, svc2IP, servicePort))
|
||||
|
||||
// Start another service and verify both are up.
|
||||
ginkgo.By("creating service3 in namespace " + ns)
|
||||
podNames3, svc3IP, err := framework.StartServeHostnameService(cs, getServeHostnameService("service3"), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc3IP, ns)
|
||||
ginkgo.By("creating service " + svc3 + " in namespace " + ns)
|
||||
podNames3, svc3IP, err := framework.StartServeHostnameService(cs, getServeHostnameService(svc3), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc3, ns)
|
||||
|
||||
if svc2IP == svc3IP {
|
||||
framework.Failf("service IPs conflict: %v", svc2IP)
|
||||
}
|
||||
|
||||
ginkgo.By("verifying service2 is still up")
|
||||
ginkgo.By("verifying service " + svc2 + " is still up")
|
||||
framework.ExpectNoError(framework.VerifyServeHostnameServiceUp(cs, ns, host, podNames2, svc2IP, servicePort))
|
||||
|
||||
ginkgo.By("verifying service3 is up")
|
||||
ginkgo.By("verifying service " + svc3 + " is up")
|
||||
framework.ExpectNoError(framework.VerifyServeHostnameServiceUp(cs, ns, host, podNames3, svc3IP, servicePort))
|
||||
})
|
||||
|
||||
@ -385,20 +389,20 @@ var _ = SIGDescribe("Services", func() {
|
||||
ns := f.Namespace.Name
|
||||
numPods, servicePort := 3, defaultServeHostnameServicePort
|
||||
|
||||
svc1 := "service1"
|
||||
svc2 := "service2"
|
||||
svc1 := "restart-proxy-1"
|
||||
svc2 := "restart-proxy-2"
|
||||
|
||||
defer func() {
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, svc1))
|
||||
}()
|
||||
podNames1, svc1IP, err := framework.StartServeHostnameService(cs, getServeHostnameService(svc1), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc1IP, ns)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc1, ns)
|
||||
|
||||
defer func() {
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, svc2))
|
||||
}()
|
||||
podNames2, svc2IP, err := framework.StartServeHostnameService(cs, getServeHostnameService(svc2), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc2IP, ns)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc2, ns)
|
||||
|
||||
if svc1IP == svc2IP {
|
||||
framework.Failf("VIPs conflict: %v", svc1IP)
|
||||
@ -441,11 +445,14 @@ var _ = SIGDescribe("Services", func() {
|
||||
ns := f.Namespace.Name
|
||||
numPods, servicePort := 3, 80
|
||||
|
||||
svc1 := "restart-apiserver-1"
|
||||
svc2 := "restart-apiserver-2"
|
||||
|
||||
defer func() {
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, "service1"))
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, svc1))
|
||||
}()
|
||||
podNames1, svc1IP, err := framework.StartServeHostnameService(cs, getServeHostnameService("service1"), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc1IP, ns)
|
||||
podNames1, svc1IP, err := framework.StartServeHostnameService(cs, getServeHostnameService(svc1), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc1, ns)
|
||||
|
||||
hosts, err := e2essh.NodeSSHHosts(cs)
|
||||
framework.ExpectNoError(err, "failed to find external/internal IPs for every node")
|
||||
@ -469,10 +476,10 @@ var _ = SIGDescribe("Services", func() {
|
||||
|
||||
// Create a new service and check if it's not reusing IP.
|
||||
defer func() {
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, "service2"))
|
||||
framework.ExpectNoError(framework.StopServeHostnameService(f.ClientSet, ns, svc2))
|
||||
}()
|
||||
podNames2, svc2IP, err := framework.StartServeHostnameService(cs, getServeHostnameService("service2"), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc2IP, ns)
|
||||
podNames2, svc2IP, err := framework.StartServeHostnameService(cs, getServeHostnameService(svc2), ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svc2, ns)
|
||||
|
||||
if svc1IP == svc2IP {
|
||||
framework.Failf("VIPs conflict: %v", svc1IP)
|
||||
@ -1672,25 +1679,25 @@ var _ = SIGDescribe("Services", func() {
|
||||
})
|
||||
|
||||
ginkgo.It("should have session affinity work for service with type clusterIP", func() {
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-clusterip")
|
||||
svc.Spec.Type = v1.ServiceTypeClusterIP
|
||||
execAffinityTestForNonLBService(f, cs, svc)
|
||||
})
|
||||
|
||||
ginkgo.It("should be able to switch session affinity for service with type clusterIP", func() {
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-clusterip-transition")
|
||||
svc.Spec.Type = v1.ServiceTypeClusterIP
|
||||
execAffinityTestForNonLBServiceWithTransition(f, cs, svc)
|
||||
})
|
||||
|
||||
ginkgo.It("should have session affinity work for NodePort service", func() {
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-nodeport")
|
||||
svc.Spec.Type = v1.ServiceTypeNodePort
|
||||
execAffinityTestForNonLBService(f, cs, svc)
|
||||
})
|
||||
|
||||
ginkgo.It("should be able to switch session affinity for NodePort service", func() {
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-nodeport-transition")
|
||||
svc.Spec.Type = v1.ServiceTypeNodePort
|
||||
execAffinityTestForNonLBServiceWithTransition(f, cs, svc)
|
||||
})
|
||||
@ -1700,7 +1707,7 @@ var _ = SIGDescribe("Services", func() {
|
||||
// L4 load balancer affinity `ClientIP` is not supported on AWS ELB.
|
||||
framework.SkipIfProviderIs("aws")
|
||||
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-lb-esipp")
|
||||
svc.Spec.Type = v1.ServiceTypeLoadBalancer
|
||||
svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
|
||||
execAffinityTestForLBService(f, cs, svc)
|
||||
@ -1711,7 +1718,7 @@ var _ = SIGDescribe("Services", func() {
|
||||
// L4 load balancer affinity `ClientIP` is not supported on AWS ELB.
|
||||
framework.SkipIfProviderIs("aws")
|
||||
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-lb-esipp-transition")
|
||||
svc.Spec.Type = v1.ServiceTypeLoadBalancer
|
||||
svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
|
||||
execAffinityTestForLBServiceWithTransition(f, cs, svc)
|
||||
@ -1722,7 +1729,7 @@ var _ = SIGDescribe("Services", func() {
|
||||
// L4 load balancer affinity `ClientIP` is not supported on AWS ELB.
|
||||
framework.SkipIfProviderIs("aws")
|
||||
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-lb")
|
||||
svc.Spec.Type = v1.ServiceTypeLoadBalancer
|
||||
svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeCluster
|
||||
execAffinityTestForLBService(f, cs, svc)
|
||||
@ -1733,7 +1740,7 @@ var _ = SIGDescribe("Services", func() {
|
||||
// L4 load balancer affinity `ClientIP` is not supported on AWS ELB.
|
||||
framework.SkipIfProviderIs("aws")
|
||||
|
||||
svc := getServeHostnameService("service")
|
||||
svc := getServeHostnameService("affinity-lb-transition")
|
||||
svc.Spec.Type = v1.ServiceTypeLoadBalancer
|
||||
svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeCluster
|
||||
execAffinityTestForLBServiceWithTransition(f, cs, svc)
|
||||
@ -1755,13 +1762,13 @@ var _ = SIGDescribe("Services", func() {
|
||||
// svcToggled: Created without the label then the label is toggled verifying reachability at each step.
|
||||
|
||||
ginkgo.By("creating service-disabled in namespace " + ns)
|
||||
svcDisabled := getServeHostnameService("service-disabled")
|
||||
svcDisabled := getServeHostnameService("service-proxy-disabled")
|
||||
svcDisabled.ObjectMeta.Labels = serviceProxyNameLabels
|
||||
_, svcDisabledIP, err := framework.StartServeHostnameService(cs, svcDisabled, ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svcDisabledIP, ns)
|
||||
|
||||
ginkgo.By("creating service in namespace " + ns)
|
||||
svcToggled := getServeHostnameService("service")
|
||||
svcToggled := getServeHostnameService("service-proxy-toggled")
|
||||
podToggledNames, svcToggledIP, err := framework.StartServeHostnameService(cs, svcToggled, ns, numPods)
|
||||
framework.ExpectNoError(err, "failed to create replication controller with service: %s in the namespace: %s", svcToggledIP, ns)
|
||||
|
||||
@ -1991,7 +1998,7 @@ var _ = SIGDescribe("ESIPP [Slow] [DisabledForLargeClusters]", func() {
|
||||
|
||||
ginkgo.It("should work for type=LoadBalancer", func() {
|
||||
namespace := f.Namespace.Name
|
||||
serviceName := "external-local"
|
||||
serviceName := "external-local-lb"
|
||||
jig := framework.NewServiceTestJig(cs, serviceName)
|
||||
|
||||
svc := jig.CreateOnlyLocalLoadBalancerService(namespace, serviceName, loadBalancerCreateTimeout, true, nil)
|
||||
@ -2029,7 +2036,7 @@ var _ = SIGDescribe("ESIPP [Slow] [DisabledForLargeClusters]", func() {
|
||||
|
||||
ginkgo.It("should work for type=NodePort", func() {
|
||||
namespace := f.Namespace.Name
|
||||
serviceName := "external-local"
|
||||
serviceName := "external-local-nodeport"
|
||||
jig := framework.NewServiceTestJig(cs, serviceName)
|
||||
|
||||
svc := jig.CreateOnlyLocalNodePortService(namespace, serviceName, true)
|
||||
@ -2056,7 +2063,7 @@ var _ = SIGDescribe("ESIPP [Slow] [DisabledForLargeClusters]", func() {
|
||||
|
||||
ginkgo.It("should only target nodes with endpoints", func() {
|
||||
namespace := f.Namespace.Name
|
||||
serviceName := "external-local"
|
||||
serviceName := "external-local-nodes"
|
||||
jig := framework.NewServiceTestJig(cs, serviceName)
|
||||
nodes := jig.GetNodes(framework.MaxNodesForEndpointsTests)
|
||||
|
||||
@ -2122,7 +2129,7 @@ var _ = SIGDescribe("ESIPP [Slow] [DisabledForLargeClusters]", func() {
|
||||
|
||||
ginkgo.It("should work from pods", func() {
|
||||
namespace := f.Namespace.Name
|
||||
serviceName := "external-local"
|
||||
serviceName := "external-local-pods"
|
||||
jig := framework.NewServiceTestJig(cs, serviceName)
|
||||
nodes := jig.GetNodes(framework.MaxNodesForEndpointsTests)
|
||||
|
||||
@ -2172,7 +2179,7 @@ var _ = SIGDescribe("ESIPP [Slow] [DisabledForLargeClusters]", func() {
|
||||
|
||||
ginkgo.It("should handle updates to ExternalTrafficPolicy field", func() {
|
||||
namespace := f.Namespace.Name
|
||||
serviceName := "external-local"
|
||||
serviceName := "external-local-update"
|
||||
jig := framework.NewServiceTestJig(cs, serviceName)
|
||||
|
||||
nodes := jig.GetNodes(framework.MaxNodesForEndpointsTests)
|
||||
|
Loading…
Reference in New Issue
Block a user