auto-sync: 2026-06-01 22:45:47
This commit is contained in:
@@ -194,19 +194,13 @@ class TestConcurrencyControl:
|
||||
assert "busy" in result["reason"].lower()
|
||||
|
||||
def test_counter_releases_on_error(self, dispatcher, task_pending):
|
||||
"""spawn 失败后释放 counter"""
|
||||
"""spawn 失败后释放 counter(v2.8 #07: counter.release 由 spawn_full_agent 内部保证)"""
|
||||
mock_spawner = MagicMock()
|
||||
mock_spawner.spawn_full_agent = AsyncMock(side_effect=RuntimeError("fail"))
|
||||
mock_counter = MagicMock()
|
||||
mock_counter.can_acquire = AsyncMock(return_value=True)
|
||||
mock_counter.acquire = AsyncMock()
|
||||
mock_counter.release = MagicMock()
|
||||
dispatcher.spawner = mock_spawner
|
||||
dispatcher.counter = mock_counter
|
||||
|
||||
result = asyncio.run(dispatcher.dispatch(task_pending))
|
||||
assert result["status"] == "error"
|
||||
mock_counter.release.assert_called_once_with("zhangfei-dev")
|
||||
|
||||
def test_local_not_blocked_by_counter(self, dispatcher, task_pending):
|
||||
"""本地执行不受 counter 限制"""
|
||||
|
||||
Reference in New Issue
Block a user