Repository navigation
Commit 25cd8e9
authored
test: fix flaky webhook dispatch pagination test (#843)
## What & why
`test_webhook_dispatch_list_pagination` was flaky on CI ([failing
run](https://github.com/apify/apify-client-python/actions/runs/26631332682/job/78480663231)).
The offset check fetched two `desc=True` (newest-first) pages and
asserted they start with different ids. But webhook dispatches created
by other tests running in parallel land at the **head** of the
desc-ordered list, shifting the window between the two calls. When ≥5
new dispatches appeared between the calls, page 1's first item slid to
offset 5 — so both pages started with the same id and the assertion
failed.
## Fix
Query the offset window in **ascending** order (`desc=False`) so it's
anchored to the oldest dispatches. New dispatches append at the tail,
leaving the front window stable, and the global-oldest item can never
reach offset 5. This is race-free while still exercising the `offset`
parameter. The `desc=True` ordering assertion is kept unchanged.1 parent d2ab2ae commit 25cd8e9
1 file changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | | - | |
| 81 | + | |
0 commit comments