fix(tests): make services + tcpforward tests robust under DinD #18
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/test-flakes-container-env"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes two tests that failed under the Forgejo runner's Docker-in-Docker check job.
Changes
host::services-run_systemctlnow maps the stderr line "System has not been booted with systemd as init system" (and the two related bus-init messages) toServiceError::NotAvailableinstead ofSystemctlFailed. The test fixture already acceptsNotAvailable; in container hosts where systemctl exists but cannot operate, the semantic is the same.host::tcpforward::tests::unreachable_port_replies_tcpconnect_err- retargets todefinitely-not-a-host.invalid(RFC 6761 reserved TLD). The previous "bind to 127.0.0.1:0, drop listener, connect to the released port" was racy under DinD: the kernel sometimes reused the port for an unrelated listener between the drop and the connect, so the manager took the success path and the test panicked on "outbox closed" once the reader task exited. The resolve branch inTcpForwardManager::opensends a deterministictcpconnect_err, no TCP-layer race.justfile- thecheck-*recipes now pass--buildtodocker compose runso the cosmetic "pull access denied for dev-vervain-agent-builder" line stops appearing before the actual build. Thedev-vervain-agent-builderimage name has no registry prefix; compose otherwise tries to pull, fails, and falls back to building. Adding--buildskips the probe entirely.Test plan
cargo test -p meshagent --lib -- host::services host::tcpforward(11/11 passing).Follow-up to the prior commit on this branch: the `just check-*` recipes use a local-only image name (`dev-vervain-agent-builder`, no registry prefix) so `docker compose run` always tries to pull it, fails ("pull access denied for dev-vervain-agent-builder"), then falls back to building. Adding `--build` skips the registry probe entirely. Cosmetic only.