mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 11:49:28 +00:00
Live test made opt-in (OUSAST_AX_LIVE=1) against the digest-pinned manifest up.sh renders, so the host gate no longer depends on cluster state. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
"""ai-service-plane Req 3.5/3.6: one trivial Task end to end on the real ax cluster of ``ops/ax/up.sh``.
|
|
|
|
Marker ``ax``; opt-in only (``OUSAST_AX_LIVE=1``) and skipped unless every check of ``ousast plane doctor``
|
|
passes, so the host suite never depends on cluster state. It applies the digest-pinned smoke manifest that
|
|
``ops/ax/up.sh`` renders. Run it on purpose: ``OUSAST_AX_LIVE=1 pytest -m ax tests/test_plane_ax_live.py``.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import time
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from openultrasast.plane.reconciler import Ax, doctor
|
|
|
|
pytestmark = pytest.mark.ax
|
|
SMOKE = Path.home() / ".cache/ousast/ax-src/smoke-task.yaml"
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def live_ax() -> Ax:
|
|
if os.environ.get("OUSAST_AX_LIVE") != "1":
|
|
pytest.skip("live ax test is opt-in: set OUSAST_AX_LIVE=1")
|
|
checks = doctor()
|
|
failing = [f"{name}: {text}" for name, ok, text in checks if not ok]
|
|
if failing:
|
|
pytest.skip("no live ax cluster: " + "; ".join(failing))
|
|
if not SMOKE.is_file():
|
|
pytest.skip(f"{SMOKE} is not in this checkout")
|
|
return Ax()
|
|
|
|
|
|
def test_smoke_task_completes_on_the_cluster(live_ax: Ax) -> None:
|
|
live_ax.apply(SMOKE)
|
|
deadline = time.monotonic() + 600
|
|
phase = "Pending"
|
|
try:
|
|
while time.monotonic() < deadline:
|
|
phase = live_ax.phase("ousast-smoke")
|
|
if any(word in phase.lower() for word in ("completed", "succeeded", "failed", "error")):
|
|
break
|
|
time.sleep(5)
|
|
finally:
|
|
live_ax.delete("ousast-smoke")
|
|
assert phase.lower() in ("completed", "succeeded"), f"smoke task ended in phase {phase!r}"
|