ci(e2e): on-demand Meshtasticator e2e job for the docker-enabled runner

Adds .gitea/workflows/meshtasticator-e2e.yaml (workflow_dispatch until
validated green, pull_request trigger commented out): builds the pinned
Hermes contract env like release.yaml, installs the plugin with deps,
checks out Meshtasticator at a pinned commit, installs the simulator's
own (conflicting-version) requirements in an isolated venv, then runs
scripts/meshtasticator_e2e/run_e2e.sh --mode docker.

Supporting changes:
- run_e2e.sh: SIM_VENV support; automatic localhost->daemon TCP forwards
  (scripts/meshtasticator_e2e/tcp_forward.py) when DOCKER_HOST is a tcp://
  daemon, because Meshtasticator hardcodes localhost for its node control
  connections; node-boot settle wait; fixed docker cleanup (container
  'Meshtastic', volume 'Meshtasticator').
- e2e tests: connect via a module-long event loop in a background thread
  (adapter requires a running loop for watchdog + inbound dispatch, so
  per-call asyncio.run was wrong) with retry while the node TCP API boots.
- README: sim-venv guidance, remote-daemon forwarding, CI section.

Docker access follows the deployment examples in
eric/actions-docker (docker is available to runner jobs).
This commit is contained in:
2026-09-07 21:04:56 -07:00
parent a4abb5d15d
commit 4485ec3814
5 changed files with 306 additions and 23 deletions
+38 -4
View File
@@ -22,9 +22,12 @@ simulated node.
```
scripts/meshtasticator_e2e/
run_e2e.sh orchestrator: boots N nodes, runs pytest, tears down
tcp_forward.py localhost->daemon TCP forward (remote docker daemons)
README.md this file
plugin/tests/e2e/
test_meshtasticator_e2e.py the e2e assertions (skip-gated)
.gitea/workflows/
meshtasticator-e2e.yaml on-demand CI job (docker-enabled runner)
```
## Prerequisites
@@ -38,10 +41,20 @@ plugin/tests/e2e/
(`-e plugin` installs the meshtastic client library the tests also use.)
* A clone of Meshtasticator: `git clone https://github.com/meshtastic/meshtasticator`
* Runtime for the simulator — pick one:
* **Docker** (simplest, works on macOS/Windows): the simulator builds
MeshtasticD from a container image on first run (slow once).
* **Docker** (simplest, works on macOS/Windows): the simulator pulls the
`meshtastic/meshtasticd` image on first run (slow once). Node TCP API ports
are published on your docker host's localhost, which is what the simulator
itself expects.
* **Linux native**: build MeshtasticD's `native` PlatformIO target and pass
the build dir with `--program`.
* Optional but recommended: an isolated simulator venv, because Meshtasticator
pins old client libs (`meshtastic~=2.6.1` in its requirements.txt):
```bash
uv venv --python 3.13 /tmp/sim-venv
uv pip install --python /tmp/sim-venv/bin/python \
-r <meshtasticator>/requirements.txt docker
export SIM_VENV=/tmp/sim-venv # else the script uses plain `python3`
```
## Run
@@ -64,9 +77,26 @@ connections (Meshtasticator assigns node *n* → port `4404 + n`), then runs
`pytest plugin/tests/e2e` with `MESHTASTICATOR_E2E=1`. Simulator output lands in
`meshtasticator-sim.log` at the repo root.
**Remote docker daemon** (`DOCKER_HOST=tcp://host:2375`): the simulator's own
control connections assume nodes listen on localhost, so the script starts a
`tcp_forward.py` per node port (localhost → daemon host) before booting the
simulator. Nothing is forwarded when the daemon is local (unset/unix
`DOCKER_HOST`).
Without `MESHTASTICATOR_E2E=1` the e2e module skips, so ordinary unit/CI runs
stay fast and gateway-free.
## CI
`.gitea/workflows/meshtasticator-e2e.yaml` runs the whole flow on a
docker-enabled runner (on demand via `workflow_dispatch` until validated, then
flip on the commented `pull_request` trigger): it builds the Hermes contract
env (pinned like `release.yaml`), installs the plugin with deps, clones
Meshtasticator at a pinned commit, installs the simulator's own requirements in
an isolated venv, and calls `run_e2e.sh --mode docker`. Simulator logs print on
failure. Only one e2e run at a time (the sim hardcodes the `Meshtastic`
container/volume name on the shared daemon).
## What the tests do
1. **Inbound**: peer node 1 broadcasts text; the adapter (connected to node 0)
@@ -95,5 +125,9 @@ items are expected to need iteration there:
lifecycle control (native mode subprocesses; docker mode currently runs all
nodes in one container), so the adapter's watchdog reconnect is **not** yet
exercised here. See the watchdog unit coverage in the adapter for now.
* **CI wiring**: an e2e job needs a docker-enabled runner and tolerates a long
first-run firmware build — deliberately left out of this PR.
* **CI validation run**: `.gitea/workflows/meshtasticator-e2e.yaml` is drafted
and on-demand only; it still needs a first green run on the docker-enabled
runner (topology assumptions: docker reachable from the job, node ports on
the job's localhost via the automatic tcp forwards). Trigger it via
`workflow_dispatch`, watch the sim log step, and only then enable the
`pull_request` trigger.