test(obs): retain legacy SigNoz topology redaction

This commit is contained in:
ogt
2026-07-15 03:07:34 +08:00
parent fbe7615e12
commit 9e69aca8fc
3 changed files with 8 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ _ENDPOINT_ALIASES = {
"192.168.0.188:11434": "host:observability-a/ollama",
"192.168.0.188:8088": "host:observability-a/openclaw-legacy",
"192.168.0.188:8089": "host:observability-a/openclaw",
"192.168.0.188:3301": "host:observability-a/signoz",
"192.168.0.188:5432": "host:observability-a/postgres",
"192.168.0.188:6380": "host:observability-a/redis",
}

View File

@@ -31,13 +31,17 @@ def test_redact_public_lan_text_replaces_internal_endpoints_with_aliases() -> No
def test_redact_public_lan_topology_recurses_json_values() -> None:
payload = {
"safe_key": "unchanged",
"nested": [{"endpoint": "192.168.0.110:8080"}],
"nested": [
{"endpoint": "192.168.0.110:8080"},
{"endpoint": "192.168.0.188:3301"},
],
}
redacted = redact_public_lan_topology(payload)
assert redacted["safe_key"] == "unchanged"
assert redacted["nested"][0]["endpoint"] == "host:public-gateway/signoz"
assert redacted["nested"][1]["endpoint"] == "host:observability-a/signoz"
def test_redact_public_lan_text_replaces_internal_work_context_terms() -> None:

View File

@@ -158,7 +158,8 @@ def test_active_api_source_has_no_legacy_signoz_ui_route() -> None:
offenders = [
str(path.relative_to(REPO_ROOT))
for path in source_root.rglob("*.py")
if LEGACY_URL in path.read_text(encoding="utf-8")
if path.name != "public_redaction.py"
and LEGACY_URL in path.read_text(encoding="utf-8")
]
assert offenders == []