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

@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
It("should set valid auth-tls-secret", func() {
host := "authtls.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
f.KubeClientSet,
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
req := gorequest.New()
uri := "/"
resp, _, errs := req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
Set("Host", host).
End()
@ -85,7 +85,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
// Send Request Passing the Client Certs
resp, _, errs = req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(clientConfig).
Set("Host", host).
End()
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
It("should set valid auth-tls-secret, sslVerify to off, and sslVerifyDepth to 2", func() {
host := "authtls.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
_, err := framework.CreateIngressMASecret(
f.KubeClientSet,
@ -129,7 +129,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
req := gorequest.New()
uri := "/"
resp, _, errs := req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
Set("Host", host).
End()
@ -139,7 +139,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
It("should set valid auth-tls-secret, pass certificate to upstream, and error page", func() {
host := "authtls.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
errorPath := "/error"
@ -152,7 +152,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
annotations := map[string]string{
"nginx.ingress.kubernetes.io/auth-tls-secret": nameSpace + "/" + host,
"nginx.ingress.kubernetes.io/auth-tls-error-page": f.IngressController.HTTPURL + errorPath,
"nginx.ingress.kubernetes.io/auth-tls-error-page": f.GetURL(framework.HTTP) + errorPath,
"nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream": "true",
}
@ -165,7 +165,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
sslVerify := "ssl_verify_client on;"
sslVerifyDepth := "ssl_verify_depth 1;"
sslErrorPage := fmt.Sprintf("error_page 495 496 = %s;", f.IngressController.HTTPURL+errorPath)
sslErrorPage := fmt.Sprintf("error_page 495 496 = %s;", f.GetURL(framework.HTTP)+errorPath)
sslUpstreamClientCert := "proxy_set_header ssl-client-cert $ssl_client_escaped_cert;"
f.WaitForNginxServer(host,
@ -183,18 +183,18 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
req := gorequest.New()
uri := "/"
resp, _, errs := req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
Set("Host", host).
RedirectPolicy(noRedirectPolicyFunc).
End()
Expect(errs).Should(BeEmpty())
Expect(resp.StatusCode).Should(Equal(http.StatusFound))
Expect(resp.Header.Get("Location")).Should(Equal(f.IngressController.HTTPURL + errorPath))
Expect(resp.Header.Get("Location")).Should(Equal(f.GetURL(framework.HTTP) + errorPath))
// Send Request Passing the Client Certs
resp, _, errs = req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(clientConfig).
Set("Host", host).
End()