Skip to content

Commit dde79ec

Browse files
committed
test: fix flaky test_request_queue_unlock_requests
Add a brief eventual-consistency settle between locking and unlocking so all three lock writes propagate to the replica unlock_requests reads, preventing the intermittent 'assert 2 == 3' on unlocked_count.
1 parent beab127 commit dde79ec

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎tests/integration/test_request_queue.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ async def test_request_queue_unlock_requests(client: ApifyClient | ApifyClientAs
561561
lock_response = result
562562
assert len(lock_response.items) == 3
563563

564+
# Wait briefly for eventual consistency: the lock-head response is acknowledged before all
565+
# three lock writes have propagated to the replica that `unlock_requests` reads, so unlocking
566+
# immediately can see fewer locks than were just acquired.
567+
await maybe_sleep(3, is_async=is_async)
568+
564569
# Unlock all requests
565570
unlock_response = await maybe_await(rq_client.unlock_requests())
566571
assert isinstance(unlock_response, UnlockRequestsResult)

0 commit comments

Comments
 (0)