Refactor e2e Tests to use common helper function

Each e2e test is creating the same(or similar) Ingress Resource in
different ways. This makes common ingress resource creation be
performed by a framework  method, reducing code duplication
This commit is contained in:
Fernando Diaz 2018-10-08 21:32:25 -05:00
parent 808c2be914
commit 44a11898d8
9 changed files with 207 additions and 643 deletions

View file

@ -39,11 +39,13 @@ var _ = framework.IngressNginxDescribe("Annotations - custom default-backend", f
Context("when default backend annotation is enabled", func() {
It("should use a custom default backend as upstream", func() {
host := "default-backend"
annotations := map[string]string{
"nginx.ingress.kubernetes.io/default-backend": "http-svc",
}
ing, err := f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "invalid", 80, &annotations))
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "invalid", 80, &annotations)
_, err := f.EnsureIngress(ing)
Expect(err).NotTo(HaveOccurred())
Expect(ing).NotTo(BeNil())