11"""Tests for map_completion."""
22
3- import json
4-
53import pytest
64
75from src .map import map_completion
@@ -23,19 +21,11 @@ def test_reproduce_completion_config_behavior_with_detailed_logging(durable_runn
2321
2422 result_data = deserialize_operation_payload (result .result )
2523
26- # 4 or 5 items are processed despite min_successful=2, which is expected due to the concurrent executor nature.
27- # When the completion requirements are met and 2 items succeed, a completion event is set and the main thread
28- # continues to cancel remaining futures. However, background threads cannot be stopped immediately since they're
29- # not in the critical section. There's a gap between setting the completion_event and all futures actually stopping,
30- # during which concurrent threads continue processing and increment counters. With max_concurrency=3 and 5 items,
31- # 4 or 5 items may complete before the cancellation takes effect. This means >= 4 items are processed as expected
32- # due to concurrency, with 4 or 5 items being typical in practice.
33- #
24+ # 5 items are processed 2 of them succeeded. We exit early because min_successful is 2.
3425 # Additionally, failure_count shows 0 because failed items have retry strategies configured and are still retrying
3526 # when execution completes. Failures aren't finalized until retries complete, so they don't appear in the failure_count.
36-
37- assert result_data ["totalItems" ] >= 4
38- assert result_data ["successfulCount" ] >= 2
27+ assert result_data ["totalItems" ] == 5
28+ assert result_data ["successfulCount" ] == 2
3929 assert result_data ["failedCount" ] == 0
4030 assert result_data ["hasFailures" ] is False
4131 assert result_data ["batchStatus" ] == "BatchItemStatus.SUCCEEDED"
0 commit comments