Fix a bug in Ingress update handler
This commit is contained in:
parent
8f57f9578d
commit
3fa8395f7f
3 changed files with 243 additions and 80 deletions
|
|
@ -17,10 +17,16 @@ limitations under the License.
|
|||
package settings
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/parnurzeal/gorequest"
|
||||
appsv1beta1 "k8s.io/api/apps/v1beta1"
|
||||
extensions "k8s.io/api/extensions/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||
)
|
||||
|
|
@ -64,46 +70,43 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
})
|
||||
})
|
||||
|
||||
// FIXME: This test doesn't work because of a bug in Ingress update handle in store package.
|
||||
// It("should delete Ingress updated to catch-all", func() {
|
||||
// host := "foo"
|
||||
It("should delete Ingress updated to catch-all", func() {
|
||||
host := "foo"
|
||||
|
||||
// ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
// f.EnsureIngress(ing)
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
// f.WaitForNginxServer(host,
|
||||
// func(server string) bool {
|
||||
// return strings.Contains(server, "server_name foo")
|
||||
// })
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, "server_name foo")
|
||||
})
|
||||
|
||||
// resp, _, errs := gorequest.New().
|
||||
// Get(f.IngressController.HTTPURL).
|
||||
// Set("Host", host).
|
||||
// End()
|
||||
// Expect(errs).To(BeNil())
|
||||
// Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Set("Host", host).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||
|
||||
// err := framework.UpdateIngress(f.KubeClientSet, f.IngressController.Namespace, host, func(ingress *extensions.Ingress) error {
|
||||
// ingress.Spec.Rules = nil
|
||||
// ingress.Spec.Backend = &extensions.IngressBackend{
|
||||
// ServiceName: "http-svc",
|
||||
// ServicePort: intstr.FromInt(80),
|
||||
// }
|
||||
// return nil
|
||||
// })
|
||||
// Expect(err).ToNot(HaveOccurred())
|
||||
err := framework.UpdateIngress(f.KubeClientSet, f.IngressController.Namespace, host, func(ingress *extensions.Ingress) error {
|
||||
ingress.Spec.Rules = nil
|
||||
ingress.Spec.Backend = &extensions.IngressBackend{
|
||||
ServiceName: "http-svc",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
}
|
||||
return nil
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// f.WaitForNginxConfiguration(func(cfg string) bool {
|
||||
// return !strings.Contains(cfg, "server_name foo") &&
|
||||
// !strings.Contains(cfg, `set $ingress_name "foo"`) &&
|
||||
// !strings.Contains(cfg, `set $service_name "http-svc"`)
|
||||
// })
|
||||
f.WaitForNginxConfiguration(func(cfg string) bool {
|
||||
return !strings.Contains(cfg, "server_name foo")
|
||||
})
|
||||
|
||||
// resp, _, errs = gorequest.New().
|
||||
// Get(f.IngressController.HTTPURL).
|
||||
// Set("Host", host).
|
||||
// End()
|
||||
// Expect(errs).To(BeNil())
|
||||
// Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||
// })
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Set("Host", host).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue