63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[3]
|
|
DEPLOYER = ROOT / "scripts/ops/deploy-signoz-metadata-toolchain.sh"
|
|
|
|
|
|
def test_historical_direct_host110_deployer_is_syntax_valid_and_fail_closed() -> None:
|
|
syntax = subprocess.run(
|
|
["bash", "-n", str(DEPLOYER)],
|
|
check=False,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
result = subprocess.run(
|
|
["bash", str(DEPLOYER), "--apply"],
|
|
check=False,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
|
|
assert syntax.returncode == 0, syntax.stderr
|
|
assert result.returncode == 78
|
|
receipt = json.loads(result.stdout)
|
|
assert receipt == {
|
|
"schema": "awoooi_signoz_metadata_toolchain_route_retirement_v1",
|
|
"terminal": "blocked_direct_host110_route_retired",
|
|
"replacement": "scripts/ops/deploy-signoz-metadata-toolchain-via-agent99.sh",
|
|
"production_mutation_performed": False,
|
|
"completion_claim": False,
|
|
}
|
|
|
|
|
|
def test_historical_entrypoint_contains_no_transport_or_mutation_primitive() -> None:
|
|
source = DEPLOYER.read_text(encoding="utf-8")
|
|
|
|
for forbidden in (
|
|
"192.168.0.110",
|
|
"ssh ",
|
|
"scp ",
|
|
"docker ",
|
|
"sudo ",
|
|
"curl ",
|
|
"rm ",
|
|
"mv ",
|
|
"ln ",
|
|
):
|
|
assert forbidden not in source
|
|
assert "blocked_direct_host110_route_retired" in source
|
|
assert "production_mutation_performed" in source
|
|
assert "completion_claim" in source
|
|
|
|
|
|
def test_historical_entrypoint_points_only_to_agent99_replacement() -> None:
|
|
source = DEPLOYER.read_text(encoding="utf-8")
|
|
|
|
assert "scripts/ops/deploy-signoz-metadata-toolchain-via-agent99.sh" in source
|
|
assert "github.com" not in source.casefold()
|
|
assert "ghcr.io" not in source.casefold()
|