test: cover the config-editor globals regression + secrets surfaces

- endpoint-level: a deployment/program edit via /config/* leaves castle.yaml
  globals byte-identical (the exact regression that shipped — the endpoints were
  tested but nobody asserted globals survived)
- write_program_file leaves globals untouched (core)
- /secrets/info reports the backend

Still uncovered (tracked): castle mesh CLI, direct-read refactor (dns/stacks),
backend-aware doctor, and all frontend (no test runner configured).
This commit is contained in:
2026-07-07 08:46:38 -07:00
parent faa9a99a5a
commit d6f5678948
3 changed files with 58 additions and 0 deletions

View File

@@ -86,6 +86,24 @@ def test_write_deployment_file_leaves_globals_untouched(castle_root: Path) -> No
assert cy.read_text() == before # globals byte-identical — nothing touched them
def test_write_program_file_leaves_globals_untouched(castle_root: Path) -> None:
"""Scoped program write must not rewrite castle.yaml globals either."""
from castle_core.config import load_config, write_program_file
cy = castle_root / "castle.yaml"
data = yaml.safe_load(cy.read_text())
data["role"] = "authority"
data["secrets"] = {"backend": "openbao"}
cy.write_text(yaml.safe_dump(data))
before = cy.read_text()
config = load_config(castle_root)
name = next(iter(config.programs))
write_program_file(config, name)
assert cy.read_text() == before
def test_registry_role_round_trip(tmp_path: Path) -> None:
reg = NodeRegistry(
node=NodeConfig(hostname="civil", role="authority"), deployed={}