Found while verifying PR #52. Pre-existing, not caused by the harness fix, and confirmed by re-running the identical command on the pristine tree with the change stashed.
The observation
Across repeated runs of the same command, on the same tree, with no code change, the pass count varies: 47/47, then 46/47, then 44/47, with a different random subset failing each time. The most frequently hit is registration::container_id_in_consul_meta. The failures are not always the same tests, which points at shared state or timing rather than one broken assertion.
Why it matters
The suite is the only thing covering the auto_discover Docker paths, and its green is currently luck. Any claim that it passes is worth less than it looks on a given run. This is the same class of problem as the 19 vacuous tests in #44: a suite whose green is not earned.
Likely cause, not yet confirmed
docs/dev/testing.md and AGENTS.md both assert the Docker tests are single-threaded via --test-threads=1 "enforced by .cargo/config.toml". That enforcement does not exist. .cargo/config.toml contains only rustflags; there is no test-threads setting anywhere in the repo, and the host has 4 CPUs, so cargo's default parallelism applies. The suite has therefore been running tests concurrently all along, while sharing:
- a single Consul HTTP port, 8500, reached through the mounted Docker socket
- one shared image tag,
lab-ops-auto-discover-test:latest
- one fixed config path,
/tmp/discovery.yaml, inside every test script
Any of those is enough to make concurrent tests interfere. The fixed /tmp/discovery.yaml lives inside the per-test container, so that one is probably fine; the shared Consul port and the shared image are not obviously so.
What to build
Decide the concurrency question first, then make the suite deterministic.
Acceptance criteria
Blocked by
None (can start immediately).
The --all-features question in #53 applies here too: on this host it is required, or the run reports 0 tests and exits green.
Found while verifying PR #52. Pre-existing, not caused by the harness fix, and confirmed by re-running the identical command on the pristine tree with the change stashed.
The observation
Across repeated runs of the same command, on the same tree, with no code change, the pass count varies: 47/47, then 46/47, then 44/47, with a different random subset failing each time. The most frequently hit is
registration::container_id_in_consul_meta. The failures are not always the same tests, which points at shared state or timing rather than one broken assertion.Why it matters
The suite is the only thing covering the auto_discover Docker paths, and its green is currently luck. Any claim that it passes is worth less than it looks on a given run. This is the same class of problem as the 19 vacuous tests in #44: a suite whose green is not earned.
Likely cause, not yet confirmed
docs/dev/testing.mdandAGENTS.mdboth assert the Docker tests are single-threaded via--test-threads=1"enforced by.cargo/config.toml". That enforcement does not exist..cargo/config.tomlcontains onlyrustflags; there is notest-threadssetting anywhere in the repo, and the host has 4 CPUs, so cargo's default parallelism applies. The suite has therefore been running tests concurrently all along, while sharing:lab-ops-auto-discover-test:latest/tmp/discovery.yaml, inside every test scriptAny of those is enough to make concurrent tests interfere. The fixed
/tmp/discovery.yamllives inside the per-test container, so that one is probably fine; the shared Consul port and the shared image are not obviously so.What to build
Decide the concurrency question first, then make the suite deterministic.
.cargo/config.tomlcannot enforce it: cargo has no test-threads key, so it belongs in the test invocation or CI. If concurrency is intended, the shared resources need namespacing per test.sleep 4waits are on the list to become pollers. Making a flaky parallel suite faster is the wrong order. Fix determinism first.Acceptance criteria
cargo test -p lab-ops --test auto_discover --all-featureson an unchanged tree all report the same resultAGENTS.mdanddocs/dev/testing.mdno longer claim.cargo/config.tomlenforces--test-threads=1Blocked by
None (can start immediately).
The
--all-featuresquestion in #53 applies here too: on this host it is required, or the run reports 0 tests and exits green.