@@ -374,6 +374,42 @@ spec:
374374 applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : "httpbin-service-e2e-test" }, new (apiv2.ApisixUpstream ), apisixUpstreamSpec1 )
375375 Eventually (request ).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).Should (Equal (http .StatusOK ))
376376 })
377+
378+ It ("Multiple ApisixRoute with same prefix name" , func () {
379+ const apisixRouteSpec = `
380+ apiVersion: apisix.apache.org/v2
381+ kind: ApisixRoute
382+ metadata:
383+ name: %s
384+ spec:
385+ ingressClassName: apisix
386+ http:
387+ - name: rule0
388+ match:
389+ hosts:
390+ - %s
391+ paths:
392+ - /*
393+ backends:
394+ - serviceName: httpbin-service-e2e-test
395+ servicePort: 80
396+ `
397+ By ("apply ApisixRoute" )
398+ var apisixRoute apiv2.ApisixRoute
399+ for _ , id := range []string {"11111" , "1111" , "111" , "11" , "1" } {
400+ name := fmt .Sprintf ("route-%s" , id )
401+ host := fmt .Sprintf ("httpbin-%s" , id )
402+ applier .MustApplyAPIv2 (types.NamespacedName {Namespace : s .Namespace (), Name : name }, & apisixRoute , fmt .Sprintf (apisixRouteSpec , name , host ))
403+ }
404+
405+ By ("verify ApisixRoute works" )
406+ for _ , id := range []string {"1" , "11" , "111" , "1111" , "11111" } {
407+ host := fmt .Sprintf ("httpbin-%s" , id )
408+ Eventually (func () int {
409+ return s .NewAPISIXClient ().GET ("/get" ).WithHost (host ).Expect ().Raw ().StatusCode
410+ }).WithTimeout (8 * time .Second ).ProbeEvery (time .Second ).Should (Equal (http .StatusOK ))
411+ }
412+ })
377413 })
378414
379415 Context ("Test ApisixRoute reference ApisixUpstream" , func () {
0 commit comments