Commit 03f97a3
authored
test: accept platform auto-abort in test_actor_charge_limit (#944)
## Description
The E2E test `test_actor_charge_limit` was flaky: it asserted the run
ended as `SUCCEEDED`, but occasionally observed `ABORTED` (e.g. [this CI
run](https://github.com/apify/apify-sdk-python/actions/runs/27021762318/job/79751266145?pr=941)).
### Root cause
When an Actor reaches its `max_total_charge_usd` ceiling, the **platform
automatically aborts the run** (*"Aborted automatically after reaching
the maximum cost of the run $0.20"*). That auto-abort races with the
Actor's own clean exit (`exit_code 0`), so the terminal status is
non-deterministically `SUCCEEDED` or `ABORTED`. It's a platform-side
timing race, not an SDK or test-logic bug — the actual behavior under
test (the charge limit capping the run at exactly 2 of the 4 attempted
events) held fine in both outcomes.
### Fix
Accept both `SUCCEEDED` and `ABORTED` as valid terminal statuses, keying
the wait/assert on `charged_event_counts == {'foobar': 2}` (the real
invariant).1 parent 227e7c7 commit 03f97a3
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
| |||
148 | 155 | | |
149 | 156 | | |
150 | 157 | | |
| 158 | + | |
| 159 | + | |
151 | 160 | | |
152 | 161 | | |
153 | 162 | | |
154 | | - | |
| 163 | + | |
155 | 164 | | |
156 | 165 | | |
157 | 166 | | |
158 | 167 | | |
159 | | - | |
| 168 | + | |
160 | 169 | | |
161 | 170 | | |
162 | 171 | | |
| |||
0 commit comments