@@ -262,23 +262,14 @@ def test_ingress_rate_limit_scaled_with_zone_sync(
262262 f"{ TEST_DATA } /zone-sync/configmap-with-zonesync-minimal.yaml" ,
263263 )
264264
265- print ("Step 3 : scale deployments to 2" )
265+ print ("Step 2 : scale deployments to 2" )
266266 ns = ingress_controller_prerequisites .namespace
267267 scale_deployment (kube_apis .v1 , kube_apis .apps_v1_api , "nginx-ingress" , ns , 2 )
268268
269- print ("Step 4 : check if pods are ready" )
269+ print ("Step 3 : check if pods are ready" )
270270 wait_until_all_pods_are_ready (kube_apis .v1 , ingress_controller_prerequisites .namespace )
271271
272- print ("Step 5: check sync in config" )
273- pod_name = get_first_pod_name (kube_apis .v1 , ingress_controller_prerequisites .namespace )
274-
275- ing_config = get_ingress_nginx_template_conf (
276- kube_apis .v1 ,
277- annotations_setup .namespace ,
278- annotations_setup .ingress_name ,
279- pod_name ,
280- ingress_controller_prerequisites .namespace ,
281- )
272+ print ("Step 4: check sync in config" )
282273 ingress_name = annotations_setup .ingress_name
283274 if "mergeable-scaled" in annotations_setup .ingress_src_file :
284275 minions_info = get_minions_info_from_yaml (annotations_setup .ingress_src_file )
@@ -290,7 +281,29 @@ def test_ingress_rate_limit_scaled_with_zone_sync(
290281 expected_conf_line = (
291282 f"limit_req_zone { key } zone={ annotations_setup .namespace } /{ ingress_name } _sync:{ zone_size } rate={ rate } sync;"
292283 )
293- assert expected_conf_line in ing_config
294284
295- print ("Step 6: clean up" )
285+ ic_pods = get_pod_list (kube_apis .v1 , ns )
286+ assert len (ic_pods ) == 2 , f"Expected 2 pods, but found { len (ic_pods )} "
287+ for i , pod in enumerate (ic_pods ):
288+ flag = False
289+ for retry in range (5 ):
290+ conf = get_ingress_nginx_template_conf (
291+ kube_apis .v1 ,
292+ annotations_setup .namespace ,
293+ annotations_setup .ingress_name ,
294+ pod .metadata .name ,
295+ ingress_controller_prerequisites .namespace ,
296+ )
297+
298+ if expected_conf_line in conf :
299+ flag = True
300+ print (f"Expected configuration line found in pod { pod .metadata .name } " )
301+ break
302+
303+ print (f"Expected configuration line not found in pod { pod .metadata .name } . Retrying..." )
304+ wait_before_test ()
305+
306+ assert flag , f"Failed to find expected configuration line in pod { pod .metadata .name } after 5 retries"
307+
308+ print ("Step 5: clean up" )
296309 scale_deployment (kube_apis .v1 , kube_apis .apps_v1_api , "nginx-ingress" , ns , 1 )
0 commit comments