ops-hub/scripts/hub-core-conformance.py
tegwick 75f4944144
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
implement ops hub extension contract
Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a053ff-1d6f-7fe2-ac1c-a6eb40a42a0c
2026-08-31 21:31:53 +02:00

35 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Run Ops Hub's package through a disposable hub-core reference runtime."""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--hub-core-repo", type=Path, default=Path("../hub-core"))
args = parser.parse_args()
sys.path.insert(0, str(args.hub_core_repo.resolve()))
from fastapi.testclient import TestClient
from hub_core.conformance import ConformanceHarness
from hub_core.runtime.app import create_app
from hub_core.runtime.config import RuntimeSettings
from hub_core.runtime.store import InMemoryPortStore
from ops_hub.extension_contract import load_extension_package
settings = RuntimeSettings(environment="test", backend="memory", allow_ephemeral=True)
target = TestClient(create_app(settings=settings, port_store=InMemoryPortStore()))
harness = ConformanceHarness(target)
harness.package = load_extension_package()
report = harness.run()
print(json.dumps(report.to_dict(), indent=2, sort_keys=True))
return 0 if report.passed else 1
if __name__ == "__main__":
raise SystemExit(main())