Add tests for alias annotation

This commit is contained in:
Manuel de Brito Fontes 2017-11-09 23:00:38 -03:00
parent d4fd127a1f
commit 4c1c707e9c
10 changed files with 479 additions and 57 deletions

View file

@ -18,7 +18,6 @@ package defaultbackend
import (
"crypto/tls"
"net/http"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -37,36 +36,29 @@ var _ = framework.IngressNginxDescribe("Default backend - SSL", func() {
})
It("should return a self generated SSL certificate", func() {
httpsURL, err := f.GetNginxURL(framework.HTTPS)
Expect(err).NotTo(HaveOccurred())
request := gorequest.New()
By("checking SSL Certificate using the NGINX IP address")
cm := request.Post(httpsURL)
// the default backend uses a self generated certificate
cm.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
resp, _, errs := gorequest.New().
Post(f.NginxHTTPSURL).
TLSClientConfig(&tls.Config{
// the default backend uses a self generated certificate
InsecureSkipVerify: true,
},
}
resp, _, errs := cm.End()
}).End()
Expect(len(errs)).Should(BeNumerically("==", 0))
Expect(len(resp.TLS.PeerCertificates)).Should(BeNumerically("==", 1))
for _, pc := range resp.TLS.PeerCertificates {
Expect(pc.Issuer.CommonName).Should(Equal("Kubernetes Ingress Controller Fake Certificate"))
}
By("checking SSL Certificate using the NGINX catch all server")
cm = request.Post(httpsURL)
// the default backend uses a self generated certificate
cm.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
resp, _, errs = gorequest.New().
Post(f.NginxHTTPSURL).
TLSClientConfig(&tls.Config{
// the default backend uses a self generated certificate
InsecureSkipVerify: true,
},
}
cm.Set("Host", "foo.bar.com")
resp, _, errs = cm.End()
}).
Set("Host", "foo.bar.com").End()
Expect(len(errs)).Should(BeNumerically("==", 0))
Expect(len(resp.TLS.PeerCertificates)).Should(BeNumerically("==", 1))
for _, pc := range resp.TLS.PeerCertificates {