fix(backup): preserve alert receipt identity
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m22s
CD Pipeline / build-and-deploy (push) Successful in 11m52s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 0s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 21s
CD Pipeline / post-deploy-checks (push) Successful in 2m29s
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m22s
CD Pipeline / build-and-deploy (push) Successful in 11m52s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 0s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 21s
CD Pipeline / post-deploy-checks (push) Successful in 2m29s
This commit is contained in:
@@ -63,6 +63,7 @@ from src.services.platform_operator_service import (
|
||||
_validate_callback_reply_status_filter,
|
||||
_validate_cicd_stage_filter,
|
||||
_validate_cicd_status_filter,
|
||||
_validate_incident_id_filter,
|
||||
)
|
||||
|
||||
|
||||
@@ -3859,6 +3860,83 @@ def test_remediation_summary_matches_incident_id_filter() -> None:
|
||||
assert _remediation_summary_matches_incident_id(None, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"incident_id",
|
||||
[
|
||||
"INC-20260714-A1B2",
|
||||
"INC-20260714-A1B2C3D4",
|
||||
"INC-BRR-544862858131AD18",
|
||||
"INC-BRR-0123456789ABCDEF",
|
||||
],
|
||||
)
|
||||
def test_validate_incident_id_filter_accepts_legacy_and_backup_restore_ids(
|
||||
incident_id: str,
|
||||
) -> None:
|
||||
_validate_incident_id_filter(incident_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"incident_id",
|
||||
[
|
||||
"INC-BRR-544862858131AD1",
|
||||
"INC-BRR-544862858131AD188",
|
||||
"INC-BRR-544862858131ad18",
|
||||
"INC-BRR-544862858131ZZ18",
|
||||
"INC-BRR-544862858131AD18-extra",
|
||||
"BRR-544862858131AD18",
|
||||
"arbitrary-incident",
|
||||
],
|
||||
)
|
||||
def test_validate_incident_id_filter_rejects_noncanonical_backup_restore_ids(
|
||||
incident_id: str,
|
||||
) -> None:
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
_validate_incident_id_filter(incident_id)
|
||||
|
||||
assert exc_info.value.status_code == 422
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_status_chain_queries_existing_backup_restore_incident(
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
incident_id = "INC-BRR-544862858131AD18"
|
||||
observed: dict[str, object] = {}
|
||||
|
||||
async def fake_history(incident_ids, *, limit):
|
||||
observed["history"] = (incident_ids, limit)
|
||||
return []
|
||||
|
||||
async def fake_status_chain(*, incident_ids, project_id, remediation_history):
|
||||
observed["fetch"] = (incident_ids, project_id, remediation_history)
|
||||
return {
|
||||
"schema_version": "awooop_status_chain_v1",
|
||||
"source_id": incident_ids[0],
|
||||
}
|
||||
|
||||
monkeypatch.setattr(
|
||||
platform_operator_service,
|
||||
"_fetch_run_remediation_history",
|
||||
fake_history,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
platform_operator_service,
|
||||
"_fetch_awooop_status_chain",
|
||||
fake_status_chain,
|
||||
)
|
||||
|
||||
result = await platform_operator_service.get_awooop_status_chain(
|
||||
project_id="awoooi",
|
||||
incident_ids=[incident_id],
|
||||
)
|
||||
|
||||
assert result["source_id"] == incident_id
|
||||
assert observed == {
|
||||
"history": ([incident_id], 5),
|
||||
"fetch": ([incident_id], "awoooi", []),
|
||||
}
|
||||
|
||||
|
||||
def test_list_filter_context_limit_scales_with_candidate_rows() -> None:
|
||||
assert _list_filter_context_limit(2) == 500
|
||||
assert _list_filter_context_limit(4176) == 16704
|
||||
|
||||
Reference in New Issue
Block a user