Part of the whole-repo test-suite audit (2026-09-30).
What to build
The repeated Arrange block replaced by the make_* helper the guidelines already mandate, so each test keeps only its own scenario.
Findings
crates/natmap/src/daemon.rs:1090,1098,1119,1140,1161 — five tests, each restating the same 12-line state.write().await.mapping.insert(DockerPortMap::new(...)) block. A make_state(&[("alpha", 8080, "10.0.0.2")]) helper plus one table.
crates/natmap/src/daemon.rs:1228,1247,1266 — three reconcile_addr_* tests, each with two five-line DockerPortMapRequest literals.
crates/auto-discover/src/daemon.rs:1042-1365 — ten sync_service_* tests sharing an identical eight-line Arrange (tempdir plus two fakes plus make_daemon plus make_resolved), differing only in the ResolvedPortType variant.
crates/auto-discover/src/consul.rs:389,437 — build_consul_service builds a 20-line ResolvedService literal and makes 12 assertions in one test; build_consul_service_udp_check copies the literal. One make_resolved(port_type, protocol) helper plus a table of (port_type, expected_meta).
src/cmd/dns_parser.rs:189-254,518-528 — the highest test-to-production ratio in the repo, 52 tests for 181 production lines. Eight parse_zone_*_record tests assert the same three fields with a different rtype string; can_proxy_a_record, can_proxy_aaaa_record and can_proxy_cname_record are three tests for one matches!(rtype, "A" | "AAAA" | "CNAME").
Acceptance criteria
Blocked by
None (can start immediately).
Estimated: -30 tests, -390 lines.
Part of the whole-repo test-suite audit (2026-09-30).
What to build
The repeated Arrange block replaced by the
make_*helper the guidelines already mandate, so each test keeps only its own scenario.Findings
crates/natmap/src/daemon.rs:1090,1098,1119,1140,1161— five tests, each restating the same 12-linestate.write().await.mapping.insert(DockerPortMap::new(...))block. Amake_state(&[("alpha", 8080, "10.0.0.2")])helper plus one table.crates/natmap/src/daemon.rs:1228,1247,1266— threereconcile_addr_*tests, each with two five-lineDockerPortMapRequestliterals.crates/auto-discover/src/daemon.rs:1042-1365— tensync_service_*tests sharing an identical eight-line Arrange (tempdir plus two fakes plusmake_daemonplusmake_resolved), differing only in theResolvedPortTypevariant.crates/auto-discover/src/consul.rs:389,437—build_consul_servicebuilds a 20-lineResolvedServiceliteral and makes 12 assertions in one test;build_consul_service_udp_checkcopies the literal. Onemake_resolved(port_type, protocol)helper plus a table of(port_type, expected_meta).src/cmd/dns_parser.rs:189-254,518-528— the highest test-to-production ratio in the repo, 52 tests for 181 production lines. Eightparse_zone_*_recordtests assert the same three fields with a different rtype string;can_proxy_a_record,can_proxy_aaaa_recordandcan_proxy_cname_recordare three tests for onematches!(rtype, "A" | "AAAA" | "CNAME").Acceptance criteria
make_*private helper at the top of its test module, perstandards.md§7.4consul.rs12-assertion test becomes a table or splitsstandards.md§3.6cargo test -p lab-ops_natmap --lib,cargo test -p lab-ops_auto-discover --libandcargo test -p lab-ops --libpassBlocked by
None (can start immediately).
Estimated: -30 tests, -390 lines.