Skip to content

Commit 41d1e2d

Browse files
committed
Add backoff retry for RHSSO config propagation in staging tests
- Add backoff decorator to staging_client fixture - Retry on 404 status (config not loaded yet) - Should fix timing issues in CI/Jenkins where APIcast staging hasn't polled for new OIDC configuration yet Fix formatting
1 parent c8d7d52 commit 41d1e2d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • testsuite/tests/apicast/auth/rhsso/openid_rhsso

testsuite/tests/apicast/auth/rhsso/openid_rhsso/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Conftest for the openid rhsso credentials locations tests
33
"""
44

5+
import backoff
56
import pytest
67

78

@@ -14,6 +15,21 @@ def staging_client(api_client):
1415
"""
1516
client = api_client()
1617
client.auth = None
18+
19+
original_get = client.get
20+
original_post = client.post
21+
22+
@backoff.on_predicate(backoff.expo, lambda x: x.status_code == 404, max_tries=10, max_time=60)
23+
def get_with_retry(*args, **kwargs):
24+
return original_get(*args, **kwargs)
25+
26+
@backoff.on_predicate(backoff.expo, lambda x: x.status_code == 404, max_tries=10, max_time=60)
27+
def post_with_retry(*args, **kwargs):
28+
return original_post(*args, **kwargs)
29+
30+
client.get = get_with_retry
31+
client.post = post_with_retry
32+
1733
return client
1834

1935

0 commit comments

Comments
 (0)