fix(agent): keep fresh alerts moving after receipt replay
Some checks failed
CD Pipeline / build-and-deploy (push) Blocked by required conditions
CD Pipeline / post-deploy-checks (push) Blocked by required conditions
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 44m41s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 1s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Failing after 1m3s
Some checks failed
CD Pipeline / build-and-deploy (push) Blocked by required conditions
CD Pipeline / post-deploy-checks (push) Blocked by required conditions
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 44m41s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 1s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Failing after 1m3s
This commit is contained in:
@@ -5249,6 +5249,7 @@ async def run_pending_check_modes_once(
|
||||
project_id=project_id,
|
||||
**receipt_backfill_summary,
|
||||
)
|
||||
if receipt_backfill_summary["repair_receipt_backfill_error"]:
|
||||
return {
|
||||
"claimed": 0,
|
||||
"reclaimed": 0,
|
||||
|
||||
@@ -237,10 +237,21 @@ def test_backfill_preserves_approval_and_replaces_terminal_skipped_candidate() -
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_broker_reconciles_receipts_before_claiming_fresh_work(
|
||||
async def test_broker_reconciles_receipts_then_continues_claiming_fresh_work(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
retry_replayer = AsyncMock()
|
||||
retry_replayer = AsyncMock(
|
||||
return_value={
|
||||
"scanned": 0,
|
||||
"replayed": 0,
|
||||
"check_mode_passed": 0,
|
||||
"check_mode_failed": 0,
|
||||
"runtime_stage_receipt_written": 0,
|
||||
"blockers": [],
|
||||
"error": None,
|
||||
}
|
||||
)
|
||||
fresh_claimer = AsyncMock(return_value=[])
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"_expire_stale_ansible_execution_capabilities",
|
||||
@@ -279,13 +290,31 @@ async def test_broker_reconciles_receipts_before_claiming_fresh_work(
|
||||
"run_failed_apply_check_mode_replay_once",
|
||||
retry_replayer,
|
||||
)
|
||||
monkeypatch.setattr(service, "_runtime_blockers", lambda: [])
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"recent_ansible_transport_blockers",
|
||||
AsyncMock(return_value=[]),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"claim_stale_pending_check_modes",
|
||||
AsyncMock(return_value=[]),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"claim_catalog_drift_failed_check_modes",
|
||||
AsyncMock(return_value=[]),
|
||||
)
|
||||
monkeypatch.setattr(service, "claim_pending_check_modes", fresh_claimer)
|
||||
|
||||
result = await service.run_pending_check_modes_once(limit=1)
|
||||
|
||||
assert result["claimed"] == 0
|
||||
assert result["repair_receipt_backfill_priority_tick"] is True
|
||||
assert result["repair_receipt_closure_written"] == 1
|
||||
retry_replayer.assert_not_awaited()
|
||||
retry_replayer.assert_awaited_once()
|
||||
fresh_claimer.assert_awaited_once()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user