Skip to content

Commit

Permalink
add wait and retry in scaled rate-limit test (#6940)
Browse files Browse the repository at this point in the history
  • Loading branch information
vepatel authored Dec 9, 2024
1 parent 24685fc commit 8e28c37
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tests/suite/test_rl_ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
"""
Expand All @@ -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)

0 comments on commit 8e28c37

Please sign in to comment.