@@ -60,6 +60,37 @@ var _ = framework.IngressNginxDescribeSerial("[Admission] admission controller",
60
60
assert .NotNil (ginkgo .GinkgoT (), err , "creating an ingress with the same host and path should return an error" )
61
61
})
62
62
63
+ ginkgo .It ("should not allow overlaps of host and paths without canary annotations in any rule" , func () {
64
+ host := admissionTestHost
65
+
66
+ firstIngress := framework .NewSingleIngressWithMultiplePaths (
67
+ "first-ingress" ,
68
+ []string {"/safe-path-1" , "/conflict-path" },
69
+ host ,
70
+ f .Namespace ,
71
+ framework .EchoService ,
72
+ 80 ,
73
+ nil )
74
+ _ , err := f .KubeClientSet .NetworkingV1 ().Ingresses (f .Namespace ).Create (context .TODO (), firstIngress , metav1.CreateOptions {})
75
+ assert .Nil (ginkgo .GinkgoT (), err , "creating ingress" )
76
+
77
+ f .WaitForNginxServer (host ,
78
+ func (server string ) bool {
79
+ return strings .Contains (server , fmt .Sprintf ("server_name %v" , host ))
80
+ })
81
+
82
+ secondIngress := framework .NewSingleIngressWithMultiplePaths (
83
+ "second-ingress" ,
84
+ []string {"/safe-path-2" , "/conflict-path" },
85
+ host ,
86
+ f .Namespace ,
87
+ framework .EchoService ,
88
+ 80 ,
89
+ nil )
90
+ _ , err = f .KubeClientSet .NetworkingV1 ().Ingresses (f .Namespace ).Create (context .TODO (), secondIngress , metav1.CreateOptions {})
91
+ assert .NotNil (ginkgo .GinkgoT (), err , "creating an ingress with the same host and path should return an error" )
92
+ })
93
+
63
94
ginkgo .It ("should allow overlaps of host and paths with canary annotation" , func () {
64
95
host := admissionTestHost
65
96
0 commit comments