diff --git a/tests/suite/test_oidc_fclo.py b/tests/suite/test_oidc_fclo.py index 1c2e57309a..8c636d5973 100644 --- a/tests/suite/test_oidc_fclo.py +++ b/tests/suite/test_oidc_fclo.py @@ -193,19 +193,30 @@ def test_oidc( kube_apis.v1, ingress_controller_prerequisites.namespace, "nginx-ingress-" ) - logs = kube_apis.v1.read_namespaced_pod_log(nic_pod_name, ingress_controller_prerequisites.namespace) + retry = 0 + count_fclo_initiated = 0 + logs = "" + expected_fclo_count = 2 + while count_fclo_initiated != expected_fclo_count and retry < 10: + wait_before_test(1) # wait one second before retrying - count_get_fclo = logs.count("GET /front_channel_logout?sid=") - count_fclo_initiated = logs.count("OIDC Front-Channel Logout initiated for sid:") + logs = kube_apis.v1.read_namespaced_pod_log(nic_pod_name, ingress_controller_prerequisites.namespace) - assert ( - count_get_fclo == 2 - ), f"nginx-ingress logs do not contain GET /front_channel_logout?sid= twice, got {count_get_fclo}" + count_fclo_initiated = logs.count("OIDC Front-Channel Logout initiated for sid:") + + print(f"OIDC FCLO Initiated count in the while loop: {count_fclo_initiated}, retrying... {retry}") + retry += 1 assert ( - count_fclo_initiated == 2 + count_fclo_initiated == expected_fclo_count ), f"nginx-ingress logs do not contain OIDC Front-Channel Logout initiated for sid twice, got {count_fclo_initiated}" + count_get_fclo = logs.count("GET /front_channel_logout?sid=") + + assert ( + count_get_fclo == expected_fclo_count + ), f"nginx-ingress logs do not contain GET /front_channel_logout?sid= twice, got {count_get_fclo}" + delete_secret(kube_apis.v1, secret_one_name, test_namespace) delete_secret(kube_apis.v1, secret_two_name, test_namespace) delete_policy(kube_apis.custom_objects, pol_one, test_namespace)