Commit edd23e6
authored
test: fix flaky request-reclaim tests with poll_until_condition (#919)
Fixes flaky integration tests caused by the eventually-consistent
request queue API behavior after `reclaim_request`.
## The race
After `reclaim_request`, an immediate `fetch_next_request` could return
`None`: a reclaimed request takes a moment to reappear at the queue head
(eventually-consistent API state), and in `single` mode
`call_with_exp_backoff` calls the function exactly once with no retry.
This caused intermittent `assert None is not None` failures.
## Fixes
Two tests share this exact shape — `reclaim_request` followed by an
immediate fetch-and-assert. Both now use the mode-agnostic
`poll_until_condition` helper, which polls `fetch_next_request` until it
returns a request (or times out), covering both `single` and `shared`
modes:
- `test_request_reclaim_functionality` — the originally observed flake.
- `test_request_reclaim_with_forefront` — the same latent flake, found
by sweeping the test suite for the same pattern.
Observed failure:
https://github.com/apify/apify-sdk-python/actions/runs/26645106359/job/785283856331 parent d290e40 commit edd23e6
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
| |||
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
303 | | - | |
304 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
305 | 307 | | |
306 | 308 | | |
307 | 309 | | |
| |||
0 commit comments