@@ -170,7 +170,7 @@ spec:
170170apiVersion: networking.k8s.io/v1
171171kind: Ingress
172172metadata:
173- name: api7-ingress-default
173+ name: api7-ingress-external
174174spec:
175175 rules:
176176 - host: httpbin.external
@@ -234,6 +234,63 @@ spec:
234234 Expect ().
235235 Status (200 )
236236 })
237+
238+ It ("Delete Ingress during restart" , func () {
239+ By ("create GatewayProxy" )
240+ gatewayProxy := fmt .Sprintf (gatewayProxyYaml , framework .DashboardTLSEndpoint , s .AdminKey ())
241+ err := s .CreateResourceFromStringWithNamespace (gatewayProxy , "default" )
242+ Expect (err ).NotTo (HaveOccurred (), "creating GatewayProxy" )
243+ time .Sleep (5 * time .Second )
244+
245+ By ("create Default IngressClass" )
246+ err = s .CreateResourceFromStringWithNamespace (defaultIngressClass , "" )
247+ Expect (err ).NotTo (HaveOccurred (), "creating Default IngressClass" )
248+ time .Sleep (5 * time .Second )
249+
250+ By ("create Ingress with ExternalName" )
251+ err = s .CreateResourceFromString (ingressWithExternalName )
252+ Expect (err ).NotTo (HaveOccurred (), "creating Ingress without IngressClass" )
253+ time .Sleep (5 * time .Second )
254+
255+ By ("create Ingress" )
256+ err = s .CreateResourceFromString (defaultIngress )
257+ Expect (err ).NotTo (HaveOccurred (), "creating Ingress without IngressClass" )
258+ time .Sleep (5 * time .Second )
259+
260+ By ("checking the external service response" )
261+ s .NewAPISIXClient ().
262+ GET ("/get" ).
263+ WithHost ("httpbin.external" ).
264+ Expect ().
265+ Status (200 )
266+
267+ s .NewAPISIXClient ().
268+ GET ("/get" ).
269+ WithHost ("default.example.com" ).
270+ Expect ().
271+ Status (200 )
272+
273+ s .ScaleIngress (0 )
274+
275+ By ("delete Ingress" )
276+ err = s .DeleteResourceFromString (defaultIngress )
277+ Expect (err ).NotTo (HaveOccurred (), "deleting Ingress without IngressClass" )
278+
279+ s .ScaleIngress (1 )
280+ time .Sleep (1 * time .Minute )
281+
282+ s .NewAPISIXClient ().
283+ GET ("/get" ).
284+ WithHost ("httpbin.external" ).
285+ Expect ().
286+ Status (200 )
287+
288+ s .NewAPISIXClient ().
289+ GET ("/get" ).
290+ WithHost ("default.example.com" ).
291+ Expect ().
292+ Status (404 )
293+ })
237294 })
238295
239296 Context ("IngressClass with GatewayProxy" , func () {
0 commit comments