Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/e2e/test_actor_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,19 @@ async def test_actor_charge_limit(
) -> None:
run = await run_actor(ppe_actor, max_total_charge_usd=Decimal('0.2'))

# Reaching `max_total_charge_usd` makes the platform auto-abort the run, racing with the Actor's clean exit, so
# the terminal status is either SUCCEEDED or ABORTED. What matters is that the limit capped it at 2 events.
terminal_statuses = {ActorJobStatus.SUCCEEDED, ActorJobStatus.ABORTED}

# Refetch until the charged event counts propagate on the platform.
run = await poll_until_condition(
partial(_get_run, apify_client_async, run.id),
lambda r: r.status == ActorJobStatus.SUCCEEDED and r.charged_event_counts == {'foobar': 2},
lambda r: r.status in terminal_statuses and r.charged_event_counts == {'foobar': 2},
timeout=30,
poll_interval=1,
)

assert run.status == ActorJobStatus.SUCCEEDED
assert run.status in terminal_statuses
assert run.charged_event_counts == {'foobar': 2}


Expand Down
Loading