|
4 | 4 | from uipath.platform.common.retry import ( |
5 | 5 | _MAX_BACKOFF_DELAY, |
6 | 6 | _MAX_RETRY_AFTER_DELAY, |
7 | | - RETRYABLE_STATUS_CODES, |
8 | 7 | exponential_backoff_with_jitter, |
9 | 8 | extract_retry_after_from_chain, |
10 | 9 | is_retryable_platform_exception, |
|
15 | 14 | from uipath.platform.errors import EnrichedException |
16 | 15 |
|
17 | 16 |
|
18 | | -class TestRetryableStatusCodes: |
19 | | - def test_contains_expected_codes(self): |
20 | | - assert 408 in RETRYABLE_STATUS_CODES |
21 | | - assert 429 in RETRYABLE_STATUS_CODES |
22 | | - assert 502 in RETRYABLE_STATUS_CODES |
23 | | - assert 503 in RETRYABLE_STATUS_CODES |
24 | | - assert 504 in RETRYABLE_STATUS_CODES |
25 | | - |
26 | | - def test_does_not_contain_non_retryable(self): |
27 | | - assert 400 not in RETRYABLE_STATUS_CODES |
28 | | - assert 401 not in RETRYABLE_STATUS_CODES |
29 | | - assert 403 not in RETRYABLE_STATUS_CODES |
30 | | - assert 404 not in RETRYABLE_STATUS_CODES |
31 | | - assert 500 not in RETRYABLE_STATUS_CODES |
32 | | - assert 501 not in RETRYABLE_STATUS_CODES |
33 | | - |
34 | | - def test_is_frozenset(self): |
35 | | - assert isinstance(RETRYABLE_STATUS_CODES, frozenset) |
36 | | - |
37 | | - |
38 | 17 | class TestParseRetryAfter: |
39 | 18 | def test_valid_integer(self): |
40 | 19 | assert parse_retry_after("120") == 120.0 |
@@ -170,16 +149,36 @@ def test_timeout_exception(self): |
170 | 149 | err = httpx.TimeoutException("timed out") |
171 | 150 | assert is_retryable_platform_exception(err) is True |
172 | 151 |
|
| 152 | + def test_enriched_408(self): |
| 153 | + http_err = _make_http_status_error(408) |
| 154 | + err = EnrichedException(http_err) |
| 155 | + assert is_retryable_platform_exception(err) is True |
| 156 | + |
173 | 157 | def test_enriched_429(self): |
174 | 158 | http_err = _make_http_status_error(429) |
175 | 159 | err = EnrichedException(http_err) |
176 | 160 | assert is_retryable_platform_exception(err) is True |
177 | 161 |
|
| 162 | + def test_enriched_502(self): |
| 163 | + http_err = _make_http_status_error(502) |
| 164 | + err = EnrichedException(http_err) |
| 165 | + assert is_retryable_platform_exception(err) is True |
| 166 | + |
178 | 167 | def test_enriched_503(self): |
179 | 168 | http_err = _make_http_status_error(503) |
180 | 169 | err = EnrichedException(http_err) |
181 | 170 | assert is_retryable_platform_exception(err) is True |
182 | 171 |
|
| 172 | + def test_enriched_504(self): |
| 173 | + http_err = _make_http_status_error(504) |
| 174 | + err = EnrichedException(http_err) |
| 175 | + assert is_retryable_platform_exception(err) is True |
| 176 | + |
| 177 | + def test_enriched_524_cloudflare_timeout(self): |
| 178 | + http_err = _make_http_status_error(524) |
| 179 | + err = EnrichedException(http_err) |
| 180 | + assert is_retryable_platform_exception(err) is True |
| 181 | + |
183 | 182 | def test_enriched_400_not_retryable(self): |
184 | 183 | http_err = _make_http_status_error(400) |
185 | 184 | err = EnrichedException(http_err) |
|
0 commit comments