Skip to content

Commit cefacfa

Browse files
committed
Update test and try to stress test it in CI
1 parent 3ad002e commit cefacfa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/unit/actor/test_actor_lifecycle.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ def on_event(event_type: Event) -> Callable:
216216
assert on_system_info_count == len(on_system_info)
217217

218218

219-
async def test_actor_handles_migrating_event_correctly(monkeypatch: pytest.MonkeyPatch) -> None:
219+
@pytest.mark.parametrize('_', range(1000))
220+
async def test_actor_handles_migrating_event_correctly(monkeypatch: pytest.MonkeyPatch, _: int) -> None:
220221
"""Test that Actor handles MIGRATING events correctly by emitting PERSIST_STATE."""
221222
# This should test whether when you get a MIGRATING event,
222223
# the Actor automatically emits the PERSIST_STATE event with data `{'isMigrating': True}`
223-
monkeypatch.setenv(ApifyEnvVars.PERSIST_STATE_INTERVAL_MILLIS, '500')
224224
monkeypatch.setenv(ApifyEnvVars.IS_AT_HOME, '1')
225225
monkeypatch.setenv(ActorEnvVars.RUN_ID, 'asdf')
226226

@@ -285,7 +285,7 @@ async def handler(websocket: websockets.asyncio.server.ServerConnection) -> None
285285

286286
await asyncio.sleep(1)
287287

288-
assert len(persist_state_events_data) >= 3
288+
assert len(persist_state_events_data) >= 2
289289

290290
print(persist_state_events_data)
291291

0 commit comments

Comments
 (0)