fix(iwooos): normalize wazuh receipt timestamps
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 2m27s
CD Pipeline / build-and-deploy (push) Successful in 6m55s
CD Pipeline / post-deploy-checks (push) Successful in 1m55s

This commit is contained in:
ogt
2026-07-11 11:39:44 +08:00
parent e52019ba4d
commit 4bc97290b9
2 changed files with 45 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ from __future__ import annotations
import os
from contextlib import asynccontextmanager
from datetime import datetime
from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
@@ -208,6 +208,26 @@ def test_wazuh_posture_catalog_and_playbook_are_bounded_no_write() -> None:
assert wazuh_manager["criticality"] == "P0"
def test_wazuh_runtime_readback_normalizes_mixed_receipt_timezones() -> None:
row = _complete_row()
row["candidate_created_at"] = datetime(2026, 7, 11, 3, 36)
row["check_created_at"] = datetime(
2026,
7,
11,
3,
37,
tzinfo=UTC,
)
payload = build_iwooos_wazuh_controlled_executor_runtime_readback(
row,
executor_enabled=True,
)
assert payload["latest_receipt_at"] == "2026-07-11T03:37:00+00:00"
@pytest.mark.asyncio
async def test_wazuh_posture_scheduler_enqueues_after_mcp_and_log_evidence(
monkeypatch: pytest.MonkeyPatch,