From eeeefd5ad5512433cea1a8b7de244d11d0c36c3f Mon Sep 17 00:00:00 2001 From: Audric Date: Sun, 17 May 2026 00:06:37 +0200 Subject: [PATCH] test(satellite): scaffold per-id secret topology entries --- tests/generate_configs.py | 8 ++++++++ tests/topology.py | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/tests/generate_configs.py b/tests/generate_configs.py index 3c75306..aa5957e 100644 --- a/tests/generate_configs.py +++ b/tests/generate_configs.py @@ -98,7 +98,15 @@ def generate_reflector_conf(name: str) -> str: lines += [ "[SATELLITE]", f"LISTEN_PORT={T.SATELLITE['listen_port']}", + # Default/fallback secret — used by satellites that do not + # match any SECRET_= entry below. f"SECRET={T.SATELLITE['secret']}", + # Per-id secret for SAT_PINNED. + f"SECRET_{T.SATELLITE_PINNED_ID}={T.SATELLITE_PINNED_SECRET}", + # Intentionally malformed id key — the parent must warn and + # ignore this at startup. SAT_BAD_KEY_ID still falls through + # to the default SECRET above when it connects. + f"{T.SATELLITE_BAD_KEY}={T.SATELLITE_BAD_VALUE}", "", ] diff --git a/tests/topology.py b/tests/topology.py index 658f716..064cf36 100644 --- a/tests/topology.py +++ b/tests/topology.py @@ -66,6 +66,21 @@ SATELLITE = { "listen_port": 5303, } +# Extra satellite identities used by tests/test_satellite_secrets.py. +# - SAT_PINNED has its own SECRET_=... entry in the parent's +# [SATELLITE] section. +# - SAT_UNPINNED has no per-id entry; it falls through to the default +# [SATELLITE].SECRET. +# - SAT_BAD_KEY_ID is the *id* used to verify that a malformed +# SECRET_=... key is ignored at startup; this satellite uses +# the default secret too. +SATELLITE_PINNED_ID = "SAT_PINNED" +SATELLITE_PINNED_SECRET = "secret_pinned" +SATELLITE_UNPINNED_ID = "SAT_UNPINNED" +SATELLITE_BAD_KEY_ID = "bad.id" +SATELLITE_BAD_KEY = f"SECRET_{SATELLITE_BAD_KEY_ID}" +SATELLITE_BAD_VALUE = "ignored_by_startup_validator" + # A real satellite-mode reflector — runs as a satellite of the primary # reflector. Used to verify that satellite mode preserves features like # MQTT publishing and the V2 client server.