rein-aharness/tests/test_claim_launcher.py
tegwick aedfadda0b fix(runtime): restore Binky OpenBao discovery
Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a06bfe-2a55-7ed3-bacd-879977b099bf
2026-09-04 17:46:10 +02:00

44 lines
1.5 KiB
Python

from __future__ import annotations
import os
import runpy
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SCRIPT = ROOT / "deploy" / "scripts" / "rein-aharness-claim"
def _launcher_namespace() -> dict:
return runpy.run_path(str(SCRIPT), run_name="rein_aharness_claim_test")
def test_runtime_defaults_expose_bao_and_approle(tmp_path: Path) -> None:
apply_defaults = _launcher_namespace()["_apply_runtime_defaults"]
env = apply_defaults({"PATH": "/usr/bin:/bin"}, tmp_path)
assert env["BAO_ADDR"] == "https://bao.coulomb.social"
assert env["VAULT_ADDR"] == env["BAO_ADDR"]
assert env["EXECUTOR_APPROLE_DIR"] == str(
tmp_path / ".local/rein-aharness/approle-binky-mail"
)
assert env["PATH"].split(os.pathsep)[0] == str(tmp_path / ".local/bin")
def test_runtime_defaults_preserve_explicit_configuration(tmp_path: Path) -> None:
apply_defaults = _launcher_namespace()["_apply_runtime_defaults"]
configured_bin = str(tmp_path / ".local/bin")
env = {
"BAO_ADDR": "https://bao.example.test",
"VAULT_ADDR": "https://vault.example.test",
"EXECUTOR_APPROLE_DIR": "/run/approle",
"PATH": f"{configured_bin}:/usr/bin",
}
resolved = apply_defaults(env, tmp_path)
assert resolved["BAO_ADDR"] == "https://bao.example.test"
assert resolved["VAULT_ADDR"] == "https://vault.example.test"
assert resolved["EXECUTOR_APPROLE_DIR"] == "/run/approle"
assert resolved["PATH"] == f"{configured_bin}:/usr/bin"