@@ -356,6 +356,42 @@ spec:
356356 applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin-service-e2e-test" }, new (apiv2.ApisixUpstream ), apisixUpstreamSpec1 )
357357 Eventually (request ).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).Should (Equal (http .StatusOK ))
358358 })
359+
360+ It ("Multiple ApisixRoute with same prefix name" , func () {
361+ const apisixRouteSpec = `
362+ apiVersion: apisix.apache.org/v2
363+ kind: ApisixRoute
364+ metadata:
365+ name: %s
366+ spec:
367+ ingressClassName: apisix
368+ http:
369+ - name: rule0
370+ match:
371+ hosts:
372+ - %s
373+ paths:
374+ - /*
375+ backends:
376+ - serviceName: httpbin-service-e2e-test
377+ servicePort: 80
378+ `
379+ By ("apply ApisixRoute" )
380+ var apisixRoute apiv2.ApisixRoute
381+ for _ , id := range []string {"11111" , "1111" , "111" , "11" , "1" } {
382+ name := fmt .Sprintf ("route-%s" , id )
383+ host := fmt .Sprintf ("httpbin-%s" , id )
384+ applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : name }, & apisixRoute , fmt .Sprintf (apisixRouteSpec , name , host ))
385+ }
386+
387+ By ("verify ApisixRoute works" )
388+ for _ , id := range []string {"1" , "11" , "111" , "1111" , "11111" } {
389+ host := fmt .Sprintf ("httpbin-%s" , id )
390+ Eventually (func () int {
391+ return s .NewAPISIXClient ().GET ("/get" ).WithHost (host ).Expect ().Raw ().StatusCode
392+ }).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).Should (Equal (http .StatusOK ))
393+ }
394+ })
359395 })
360396
361397 Context ("Test ApisixRoute reference ApisixUpstream" , func () {
0 commit comments