From 5ffda241a4f6c21ae0ea9744b4ebd06cf5c767eb Mon Sep 17 00:00:00 2001
From: Venktesh <ve.patel@f5.com>
Date: Mon, 9 Dec 2024 11:29:05 +0000
Subject: [PATCH] add wait in scaled test

---
 tests/suite/test_rl_ingress.py | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/tests/suite/test_rl_ingress.py b/tests/suite/test_rl_ingress.py
index da578dceee..fe9fddecf8 100644
--- a/tests/suite/test_rl_ingress.py
+++ b/tests/suite/test_rl_ingress.py
@@ -119,7 +119,7 @@ def test_ingress_rate_limit(self, kube_apis, annotations_setup, ingress_controll
 @pytest.mark.annotations
 @pytest.mark.parametrize("annotations_setup", ["standard-scaled", "mergeable-scaled"], indirect=True)
 class TestRateLimitIngressScaled:
-    def test_ingress_rate_limit_sscaled(
+    def test_ingress_rate_limit_scaled(
         self, kube_apis, annotations_setup, ingress_controller_prerequisites, test_namespace
     ):
         """
@@ -133,14 +133,20 @@ def test_ingress_rate_limit_sscaled(
             wait_before_test()
 
         ic_pods = get_pod_list(kube_apis.v1, ns)
-        for i in range(len(ic_pods)):
-            conf = get_ingress_nginx_template_conf(
-                kube_apis.v1,
-                annotations_setup.namespace,
-                annotations_setup.ingress_name,
-                ic_pods[i].metadata.name,
-                ingress_controller_prerequisites.namespace,
-            )
-            flag = ("rate=10r/s" in conf) or ("rate=13r/s" in conf)
-            assert flag
+        flag = False
+        retries = 0
+        while flag is False and retries < 10:
+            retries += 1
+            wait_before_test()
+            for i in range(len(ic_pods)):
+                conf = get_ingress_nginx_template_conf(
+                    kube_apis.v1,
+                    annotations_setup.namespace,
+                    annotations_setup.ingress_name,
+                    ic_pods[i].metadata.name,
+                    ingress_controller_prerequisites.namespace,
+                )
+                flag = ("rate=10r/s" in conf) or ("rate=13r/s" in conf)
+
+        assert flag
         scale_deployment(kube_apis.v1, kube_apis.apps_v1_api, "nginx-ingress", ns, 1)