Add MQTT integration test for talker events

Add mosquitto broker to test Docker Compose, configure [MQTT] sections
in all generated reflector configs, and add test_18_mqtt_talker_event
that verifies talker start/stop events are published to MQTT topics.
This commit is contained in:
Audric committed 2026-04-08 20:36:23 +02:00
1 parent 5b7a3dd8cd
commit bca223afbe
3 files changed
+91

No files matched your search

+26
View File
@@ -85,6 +85,18 @@ def generate_reflector_conf(name: str) -> str:
"",
]
# MQTT publishing section
lines += [
"[MQTT]",
f"HOST={T.MQTT['host']}",
f"PORT={T.MQTT['port']}",
f"USERNAME={T.MQTT['username']}",
f"PASSWORD={T.MQTT['password']}",
f"TOPIC_PREFIX=svxreflector/{name}",
"STATUS_INTERVAL=1000",
"",
]
return "\n".join(lines)
@@ -129,6 +141,20 @@ def generate_docker_compose() -> str:
networks:
- trunk_mesh""")
# Mosquitto broker for MQTT testing
services.append(""" mosquitto:
image: eclipse-mosquitto:2
command: sh -c 'echo "listener 1883" > /tmp/m.conf && echo "allow_anonymous true" >> /tmp/m.conf && mosquitto -c /tmp/m.conf -v'
ports:
- "11883:1883/tcp"
healthcheck:
test: ["CMD-SHELL", "mosquitto_pub -h localhost -t test -m test || exit 1"]
interval: 2s
timeout: 2s
retries: 10
networks:
- trunk_mesh""")
services_block = "\n\n".join(services)
volumes_block = "\n".join(f" {v}:" for v in volumes)