fix(e2e): headless TkAgg crash + readiness false-positive on forwards

Run 10536 reached pytest but every connect was reset: the simulator died at
import with 'Tkinter is needed' — lib/gui.py calls matplotlib.use("TkAgg")
unconditionally (an explicit use() overrides MPLBACKEND=Agg), and the port
probe passed instantly because it was accepting the localhost forwarders, not
the nodes.

- run_e2e.sh: patch meshtasticator lib/gui.py TkAgg->Agg before boot;
  probe readiness on the upstream host (docker daemon) when forwards are
  active; docker pull meshtastic/meshtasticd up front so the pull is off the
  simulator's node-boot path.
- e2e tests: cancel leftover loop tasks (watchdog) at loop teardown.
This commit is contained in:
2026-09-07 21:33:49 -07:00
parent 58b18d6260
commit ba31d79368
3 changed files with 44 additions and 4 deletions
+9 -1
View File
@@ -81,7 +81,15 @@ connections (Meshtasticator assigns node *n* → port `4404 + n`), then runs
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`).
`DOCKER_HOST`). Readiness is probed on the *upstream* host (the daemon), never
on the forwarders themselves.
Other headless adaptations the script makes automatically:
* patches `lib/gui.py` `matplotlib.use("TkAgg")` → `"Agg"` in the pinned
Meshtasticator checkout — the TkAgg call crashes headless runs even under
`MPLBACKEND=Agg` (only the interactive GUI mode is lost),
* warms the `meshtastic/meshtasticd` image (`docker pull`) before booting the
simulator so the pull is not on the simulator's node-boot critical path.
Without `MESHTASTICATOR_E2E=1` the e2e module skips, so ordinary unit/CI runs
stay fast and gateway-free.