implement ops hub extension contract
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a053ff-1d6f-7fe2-ac1c-a6eb40a42a0c
This commit is contained in:
parent
9bbbf2032d
commit
75f4944144
14 changed files with 662 additions and 43 deletions
35
scripts/hub-core-conformance.py
Normal file
35
scripts/hub-core-conformance.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/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())
|
||||
Loading…
Add table
Add a link
Reference in a new issue