Skip to content

Commit c058b27

Browse files
javorszkyvepatel
andauthored
Wrap oidc fclo initiated test in a while loop (#8460)
* Wrap oidc fclo initiated test in a while loop * Implement copilot suggestions --------- Co-authored-by: Venktesh Shivam Patel <[email protected]>
1 parent 1d4e949 commit c058b27

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

tests/suite/test_oidc_fclo.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,30 @@ def test_oidc(
193193
kube_apis.v1, ingress_controller_prerequisites.namespace, "nginx-ingress-"
194194
)
195195

196-
logs = kube_apis.v1.read_namespaced_pod_log(nic_pod_name, ingress_controller_prerequisites.namespace)
196+
retry = 0
197+
count_fclo_initiated = 0
198+
logs = ""
199+
expected_fclo_count = 2
200+
while count_fclo_initiated != expected_fclo_count and retry < 10:
201+
wait_before_test(1) # wait one second before retrying
197202

198-
count_get_fclo = logs.count("GET /front_channel_logout?sid=")
199-
count_fclo_initiated = logs.count("OIDC Front-Channel Logout initiated for sid:")
203+
logs = kube_apis.v1.read_namespaced_pod_log(nic_pod_name, ingress_controller_prerequisites.namespace)
200204

201-
assert (
202-
count_get_fclo == 2
203-
), f"nginx-ingress logs do not contain GET /front_channel_logout?sid= twice, got {count_get_fclo}"
205+
count_fclo_initiated = logs.count("OIDC Front-Channel Logout initiated for sid:")
206+
207+
print(f"OIDC FCLO Initiated count in the while loop: {count_fclo_initiated}, retrying... {retry}")
208+
retry += 1
204209

205210
assert (
206-
count_fclo_initiated == 2
211+
count_fclo_initiated == expected_fclo_count
207212
), f"nginx-ingress logs do not contain OIDC Front-Channel Logout initiated for sid twice, got {count_fclo_initiated}"
208213

214+
count_get_fclo = logs.count("GET /front_channel_logout?sid=")
215+
216+
assert (
217+
count_get_fclo == expected_fclo_count
218+
), f"nginx-ingress logs do not contain GET /front_channel_logout?sid= twice, got {count_get_fclo}"
219+
209220
delete_secret(kube_apis.v1, secret_one_name, test_namespace)
210221
delete_secret(kube_apis.v1, secret_two_name, test_namespace)
211222
delete_policy(kube_apis.custom_objects, pol_one, test_namespace)

0 commit comments

Comments
 (0)