use functional options to reduce number of methods creating an EchoDeployment (#8199)
This commit is contained in:
parent
0f464333a9
commit
dcd552ceb5
20 changed files with 75 additions and 51 deletions
|
|
@ -36,7 +36,7 @@ var _ = framework.DescribeAnnotation("affinity session-cookie-name", func() {
|
|||
f := framework.NewDefaultFramework("affinity")
|
||||
|
||||
ginkgo.BeforeEach(func() {
|
||||
f.NewEchoDeploymentWithReplicas(2)
|
||||
f.NewEchoDeployment(framework.WithDeploymentReplicas(2))
|
||||
})
|
||||
|
||||
ginkgo.It("should set sticky cookie SERVERID", func() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,10 @@ var _ = framework.DescribeAnnotation("affinitymode", func() {
|
|||
ginkgo.It("Balanced affinity mode should balance", func() {
|
||||
deploymentName := "affinitybalanceecho"
|
||||
replicas := 5
|
||||
f.NewEchoDeploymentWithNameAndReplicas(deploymentName, replicas)
|
||||
f.NewEchoDeployment(
|
||||
framework.WithDeploymentName(deploymentName),
|
||||
framework.WithDeploymentReplicas(replicas),
|
||||
)
|
||||
|
||||
host := "affinity-mode-balance.com"
|
||||
annotations := make(map[string]string)
|
||||
|
|
@ -64,7 +67,10 @@ var _ = framework.DescribeAnnotation("affinitymode", func() {
|
|||
ginkgo.It("Check persistent affinity mode", func() {
|
||||
deploymentName := "affinitypersistentecho"
|
||||
replicas := 5
|
||||
f.NewEchoDeploymentWithNameAndReplicas(deploymentName, replicas)
|
||||
f.NewEchoDeployment(
|
||||
framework.WithDeploymentName(deploymentName),
|
||||
framework.WithDeploymentReplicas(replicas),
|
||||
)
|
||||
|
||||
host := "affinity-mode-persistent.com"
|
||||
annotations := make(map[string]string)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
|
|||
f := framework.NewDefaultFramework("authtls")
|
||||
|
||||
ginkgo.BeforeEach(func() {
|
||||
f.NewEchoDeploymentWithReplicas(2)
|
||||
f.NewEchoDeployment(framework.WithDeploymentReplicas(2))
|
||||
})
|
||||
|
||||
ginkgo.It("should set sslClientCertificate, sslVerifyClient and sslVerifyDepth with auth-tls-secret", func() {
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ var _ = framework.DescribeAnnotation("canary-*", func() {
|
|||
|
||||
ginkgo.BeforeEach(func() {
|
||||
// Deployment for main backend
|
||||
f.NewEchoDeploymentWithReplicas(1)
|
||||
f.NewEchoDeployment()
|
||||
|
||||
// Deployment for canary backend
|
||||
f.NewEchoDeploymentWithNameAndReplicas(canaryService, 1)
|
||||
f.NewEchoDeployment(framework.WithDeploymentName(canaryService))
|
||||
})
|
||||
|
||||
ginkgo.Context("when canary is created", func() {
|
||||
|
|
@ -132,7 +132,7 @@ var _ = framework.DescribeAnnotation("canary-*", func() {
|
|||
|
||||
ginkgo.By("returning a 503 status when the mainline deployment has 0 replicas and a request is sent to the canary")
|
||||
|
||||
f.NewEchoDeploymentWithReplicas(0)
|
||||
f.NewEchoDeployment(framework.WithDeploymentReplicas(0))
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
|
|
@ -145,7 +145,7 @@ var _ = framework.DescribeAnnotation("canary-*", func() {
|
|||
|
||||
ginkgo.By("returning a 200 status when the canary deployment has 0 replicas and a request is sent to the mainline ingress")
|
||||
|
||||
f.NewEchoDeploymentWithReplicas(1)
|
||||
f.NewEchoDeployment()
|
||||
f.NewDeployment(canaryService, "k8s.gcr.io/e2e-test-images/echoserver:2.3", 8080, 0)
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ var _ = framework.DescribeAnnotation("cors-*", func() {
|
|||
f := framework.NewDefaultFramework("cors")
|
||||
|
||||
ginkgo.BeforeEach(func() {
|
||||
f.NewEchoDeploymentWithReplicas(2)
|
||||
f.NewEchoDeployment(framework.WithDeploymentReplicas(2))
|
||||
})
|
||||
|
||||
ginkgo.It("should enable cors", func() {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ var _ = framework.DescribeAnnotation("custom-http-errors", func() {
|
|||
|
||||
ginkgo.By("using the custom default-backend from annotation for upstream")
|
||||
customDefaultBackend := "from-annotation"
|
||||
f.NewEchoDeploymentWithNameAndReplicas(customDefaultBackend, 1)
|
||||
f.NewEchoDeployment(framework.WithDeploymentName(customDefaultBackend))
|
||||
|
||||
err = framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *networking.Ingress) error {
|
||||
ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/default-backend"] = customDefaultBackend
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ var _ = framework.DescribeAnnotation("proxy-ssl-*", func() {
|
|||
ginkgo.It("proxy-ssl-location-only flag should change the nginx config server part", func() {
|
||||
host := "proxyssl.com"
|
||||
|
||||
f.NewEchoDeploymentWithNameAndReplicas("echodeployment", 1)
|
||||
f.NewEchoDeployment(framework.WithDeploymentName("echodeployment"))
|
||||
|
||||
secretName := "secretone"
|
||||
annotations := make(map[string]string)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ var _ = framework.DescribeAnnotation("upstream-hash-by-*", func() {
|
|||
f := framework.NewDefaultFramework("upstream-hash-by")
|
||||
|
||||
ginkgo.BeforeEach(func() {
|
||||
f.NewEchoDeploymentWithReplicas(6)
|
||||
f.NewEchoDeployment(framework.WithDeploymentReplicas(6))
|
||||
})
|
||||
|
||||
ginkgo.It("should connect to the same pod", func() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue