Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[e2e] Make meaningful service name in test #78703

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
91 changes: 49 additions & 42 deletions test/e2e/network/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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))
})

Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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)
})
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down