Refactor e2e tests to use the service ClusterIP

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-02-22 11:03:42 -03:00
parent f04361cc06
commit 5e249d3366
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
80 changed files with 777 additions and 706 deletions

View file

@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
}
ing := framework.NewSingleIngress(host, "/something", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -56,7 +56,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
})
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/something").
Get(f.GetURL(framework.HTTP)+"/something").
Set("Host", host).
End()
@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
host := "rewrite.bar.com"
By("creating a regular ingress definition")
ing := framework.NewSingleIngress("kube-lego", "/.well-known/acme/challenge", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
ing := framework.NewSingleIngress("kube-lego", "/.well-known/acme/challenge", host, f.Namespace, "http-svc", 80, &map[string]string{})
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("making a request to the non-rewritten location")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/.well-known/acme/challenge").
Get(f.GetURL(framework.HTTP)+"/.well-known/acme/challenge").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/.well-known/acme/challenge", host)
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
annotations := map[string]string{
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
}
rewriteIng := framework.NewSingleIngress("rewrite-index", "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
rewriteIng := framework.NewSingleIngress("rewrite-index", "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(rewriteIng)
@ -106,7 +106,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("making a second request to the non-rewritten location")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL+"/.well-known/acme/challenge").
Get(f.GetURL(framework.HTTP)+"/.well-known/acme/challenge").
Set("Host", host).
End()
Expect(len(errs)).Should(Equal(0))
@ -118,7 +118,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
host := "rewrite.bar.com"
By("creating a regular ingress definition")
ing := framework.NewSingleIngress("foo", "/foo", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
ing := framework.NewSingleIngress("foo", "/foo", host, f.Namespace, "http-svc", 80, &map[string]string{})
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -131,7 +131,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/use-regex": "true",
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
}
ing = framework.NewSingleIngress("regex", "/foo.+", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing = framework.NewSingleIngress("regex", "/foo.+", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -141,7 +141,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("ensuring '/foo' matches '~* ^/foo'")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo").
Get(f.GetURL(framework.HTTP)+"/foo").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/foo", host)
@ -151,7 +151,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("ensuring '/foo/bar' matches '~* ^/foo.+'")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar").
Set("Host", host).
End()
expectBodyRequestURI = fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
@ -164,7 +164,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
host := "rewrite.bar.com"
By("creating a regular ingress definition")
ing := framework.NewSingleIngress("foo", "/foo/bar/bar", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
ing := framework.NewSingleIngress("foo", "/foo/bar/bar", host, f.Namespace, "http-svc", 80, &map[string]string{})
f.EnsureIngress(ing)
By(`creating an ingress definition with the use-regex annotation`)
@ -172,7 +172,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/use-regex": "true",
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
}
ing = framework.NewSingleIngress("regex", "/foo/bar/[a-z]{3}", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing = framework.NewSingleIngress("regex", "/foo/bar/[a-z]{3}", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -182,7 +182,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("check that '/foo/bar/bar' does not match the longest exact path")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar/bar").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
@ -199,7 +199,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/use-regex": "true",
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend/$1",
}
ing := framework.NewSingleIngress("regex", "/foo/bar/(.+)", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress("regex", "/foo/bar/(.+)", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -209,7 +209,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("check that '/foo/bar/bar' redirects to cusotm rewrite")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar/bar").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend/bar", host)