You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exit 1 sits inside a subshell — the parentheses create one. exit 1 therefore kills the subshell, not the script. Control returns to the ||, echo 'PASS' runs, and the script exits 0. The harness sees PASS.
Line 739 is docker_mapping_remove_cleans_up_loopback_masquerade, the third hairpin test, so it is both target-blind and vacuous on its removal check.
The second, quieter half
Even with the subshell unwrapped, a bare grep -q absence check is satisfiable by a broken environment: if iptables is missing, the input is empty, grep exits 1, and the rule reads as absent. The test then passes for the wrong reason. #56 fixed this for the loopback negative test with a control grep: assert the thing that should be there is visible, so a broken command fails before the absence check can succeed.
What to build
Per site, both halves:
Unwrap the subshell: if <condition>; then echo 'FAIL' >&2; <diagnostics>; exit 1; fi
Add a control assertion where the check is an absence — something that must be present, so a missing binary or a failed command cannot masquerade as "the rule is gone"
rg -c 'exit 1\) \|\| echo' tests/natmap_docker.rs is 0
Every one of the 18 sites is listed individually with before and after, so a site cannot be quietly skipped
A demonstration that each rewritten assertion can fail: inject the violating condition and show the test goes red. Do it for a representative sample covering all three shapes present in the file (presence-by-grep, absence-by-grep, and the compound forms), and say which lines each sample covers
The && (…) || shape does not survive anywhere else in tests/, checked across tests/auto_discover/ and tests/natmap_docker.rs
cargo test -p lab-ops --all-features --test natmap_docker passes, currently 35
No assertion is weakened to make a site pass
Why this was missed
#44 removed a tautological assert_pass helper from tests/auto_discover/, where the tautology was in Rust code. The same tautology exists here in shell strings, where no Rust-side audit reaches. rg for the pattern is the whole check.
Found while closing #56. This is the same defect, 18 more times, and it is the most serious thing the audit has found about the test suite.
The mechanism
tests/natmap_docker.rsuses this shape:The
exit 1sits inside a subshell — the parentheses create one.exit 1therefore kills the subshell, not the script. Control returns to the||,echo 'PASS'runs, and the script exits 0. The harness seesPASS.Proven:
Every test using this shape reports PASS when the condition it checks is violated. The
&&/||chain looks like a guard and behaves like a no-op.Sites
18 in
tests/natmap_docker.rs: lines 201, 216, 273, 293, 313, 333, 352, 371, 382, 405, 407, 462, 479, 496, 515, 537, 739, 821.Line 739 is
docker_mapping_remove_cleans_up_loopback_masquerade, the third hairpin test, so it is both target-blind and vacuous on its removal check.The second, quieter half
Even with the subshell unwrapped, a bare
grep -qabsence check is satisfiable by a broken environment: ifiptablesis missing, the input is empty, grep exits 1, and the rule reads as absent. The test then passes for the wrong reason. #56 fixed this for the loopback negative test with a control grep: assert the thing that should be there is visible, so a broken command fails before the absence check can succeed.What to build
Per site, both halves:
if <condition>; then echo 'FAIL' >&2; <diagnostics>; exit 1; fiAcceptance criteria
rg -c 'exit 1\) \|\| echo' tests/natmap_docker.rsis 0&& (…) ||shape does not survive anywhere else intests/, checked acrosstests/auto_discover/andtests/natmap_docker.rscargo test -p lab-ops --all-features --test natmap_dockerpasses, currently 35Why this was missed
#44removed a tautologicalassert_passhelper fromtests/auto_discover/, where the tautology was in Rust code. The same tautology exists here in shell strings, where no Rust-side audit reaches.rgfor the pattern is the whole check.