adjust tests to the new no-reload on cert update world

This commit is contained in:
Elvin Efendi 2019-09-25 06:59:47 -04:00
parent d8a3d616b4
commit fe2ea692a6
2 changed files with 23 additions and 59 deletions

View file

@ -103,8 +103,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
rc1, err := extractReloadCount(mf) rc1, err := extractReloadCount(mf)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
// TODO: This is wrong. We should not require a reload when SSL is configured Expect(rc0).To(BeEquivalentTo(rc1))
Expect(rc0).To(BeEquivalentTo(rc1 - 1))
}) })
Context("given an ingress with TLS correctly configured", func() { Context("given an ingress with TLS correctly configured", func() {
@ -177,41 +176,37 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
Expect(restOfLogs).ToNot(ContainSubstring(logBackendReloadSuccess)) Expect(restOfLogs).ToNot(ContainSubstring(logBackendReloadSuccess))
}) })
// TODO: Fix It("falls back to using default certificate when secret gets deleted without reloading", func() {
/* ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
It("falls back to using default certificate when secret gets deleted without reloading", func() {
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host) ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host)
ip := f.GetNginxPodIP() ip := f.GetNginxPodIP()
mf, err := f.GetMetric("nginx_ingress_controller_success", ip[0]) mf, err := f.GetMetric("nginx_ingress_controller_success", ip[0])
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(mf).ToNot(BeNil()) Expect(mf).ToNot(BeNil())
rc0, err := extractReloadCount(mf) rc0, err := extractReloadCount(mf)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
err = f.KubeClientSet.CoreV1().Secrets(ing.Namespace).Delete(ing.Spec.TLS[0].SecretName, nil) err = f.KubeClientSet.CoreV1().Secrets(ing.Namespace).Delete(ing.Spec.TLS[0].SecretName, nil)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync * 2) time.Sleep(waitForLuaSync * 2)
By("serving the default certificate on HTTPS endpoint") By("serving the default certificate on HTTPS endpoint")
ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, "ingress.local") ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, "ingress.local")
mf, err = f.GetMetric("nginx_ingress_controller_success", ip[0]) mf, err = f.GetMetric("nginx_ingress_controller_success", ip[0])
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(mf).ToNot(BeNil()) Expect(mf).ToNot(BeNil())
rc1, err := extractReloadCount(mf) rc1, err := extractReloadCount(mf)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
By("skipping Nginx reload") By("skipping Nginx reload")
// TODO: This is wrong. We should not require a reload when SSL is configured Expect(rc0).To(BeEquivalentTo(rc1))
Expect(rc0).To(BeEquivalentTo(rc1 - 1)) })
})
*/
It("picks up a non-certificate only change", func() { It("picks up a non-certificate only change", func() {
newHost := "foo2.com" newHost := "foo2.com"

View file

@ -166,37 +166,6 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
}) })
}) })
It("handles a non backend update", func() {
var nginxConfig string
f.WaitForNginxConfiguration(func(cfg string) bool {
nginxConfig = cfg
return true
})
ingress, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get("foo.com", metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
ingress.Spec.TLS = []extensions.IngressTLS{
{
Hosts: []string{"foo.com"},
SecretName: "foo.com",
},
}
_, err = framework.CreateIngressTLSSecret(f.KubeClientSet,
ingress.Spec.TLS[0].Hosts,
ingress.Spec.TLS[0].SecretName,
ingress.Namespace)
Expect(err).ToNot(HaveOccurred())
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ingress)
Expect(err).ToNot(HaveOccurred())
var newNginxConfig string
f.WaitForNginxConfiguration(func(cfg string) bool {
newNginxConfig = cfg
return true
})
Expect(nginxConfig).ShouldNot(Equal(newNginxConfig))
})
It("sets controllerPodsCount in Lua general configuration", func() { It("sets controllerPodsCount in Lua general configuration", func() {
// https://github.com/curl/curl/issues/936 // https://github.com/curl/curl/issues/936
curlCmd := fmt.Sprintf("curl --fail --silent http://localhost:%v/configuration/general", nginx.StatusPort) curlCmd := fmt.Sprintf("curl --fail --silent http://localhost:%v/configuration/general", nginx.StatusPort)