Skip to content
Merged
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
6 changes: 2 additions & 4 deletions tests/unit/actor/test_actor_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ async def test_actor_handles_migrating_event_correctly(monkeypatch: pytest.Monke
"""Test that Actor handles MIGRATING events correctly by emitting PERSIST_STATE."""
# This should test whether when you get a MIGRATING event,
# the Actor automatically emits the PERSIST_STATE event with data `{'isMigrating': True}`
monkeypatch.setenv(ApifyEnvVars.PERSIST_STATE_INTERVAL_MILLIS, '500')
monkeypatch.setenv(ApifyEnvVars.IS_AT_HOME, '1')
monkeypatch.setenv(ActorEnvVars.RUN_ID, 'asdf')

Expand Down Expand Up @@ -285,9 +284,8 @@ async def handler(websocket: websockets.asyncio.server.ServerConnection) -> None

await asyncio.sleep(1)

assert len(persist_state_events_data) >= 3

print(persist_state_events_data)
# It is enough to check the persist state event we send manually and the crawler final one.
assert len(persist_state_events_data) >= 2
Copy link
Contributor

@vdusek vdusek Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is enough to check the persist state event we send manually and the Crawler final one.

Could we just please add a comment describing this?


# Expect last event to be is_migrating=False (persistence event on exiting EventManager)
assert persist_state_events_data.pop() == EventPersistStateData(is_migrating=False)
Expand Down