|
|
@@ -1435,12 +1435,16 @@ def test_evaluate_find_agent_run_fails_for_technical_failure(
|
|
|
@patch(
|
|
|
"supply_infra.scheduler.jobs.discover_videos_from_demands.list_find_demand_contexts"
|
|
|
)
|
|
|
-def test_stops_discovery_after_300_passed_videos(
|
|
|
+def test_stops_discovery_after_daily_passed_video_limit(
|
|
|
mock_list_contexts,
|
|
|
mock_filter_contexts,
|
|
|
mock_count_passed,
|
|
|
mock_process,
|
|
|
) -> None:
|
|
|
+ from supply_infra.scheduler.jobs.discover_videos_from_demands import (
|
|
|
+ _DAILY_PASSED_VIDEO_LIMIT,
|
|
|
+ )
|
|
|
+
|
|
|
contexts = [
|
|
|
FindDemandContext(
|
|
|
biz_dt="20260727",
|
|
|
@@ -1460,8 +1464,10 @@ def test_stops_discovery_after_300_passed_videos(
|
|
|
contexts,
|
|
|
{"total_loaded": 2, "skipped_already_done": 0},
|
|
|
)
|
|
|
+ almost_full = _DAILY_PASSED_VIDEO_LIMIT - 1
|
|
|
+ full = _DAILY_PASSED_VIDEO_LIMIT
|
|
|
# 初始检查 / 执行前检查 / 执行后检查 / 收尾检查
|
|
|
- mock_count_passed.side_effect = [299, 299, 300, 300]
|
|
|
+ mock_count_passed.side_effect = [almost_full, almost_full, full, full]
|
|
|
mock_process.return_value = {
|
|
|
"success": True,
|
|
|
"skipped": False,
|
|
|
@@ -1474,8 +1480,9 @@ def test_stops_discovery_after_300_passed_videos(
|
|
|
|
|
|
assert mock_process.call_count == 1
|
|
|
assert result["processed"] == 1
|
|
|
- assert result["passed_videos"] == 300
|
|
|
+ assert result["passed_videos"] == full
|
|
|
assert result["stopped_by_passed_video_limit"] is True
|
|
|
+ assert result["passed_video_limit"] == _DAILY_PASSED_VIDEO_LIMIT
|
|
|
|
|
|
|
|
|
@patch(
|