Part of the whole-repo test-suite audit (2026-09-30). These are Fragile Fixtures: a formatting change breaks them with no behaviour change.
What to build
Tests that read the data the program produces, not the exact bytes it happened to emit.
Findings
tests/cf2ansible.rs asserts on exact YAML formatting. domain0 (:74) carries about 20 assertions across 10 unrelated behaviours; domain3 (:138) has 12; assert_common (:34) has 7. assert_type_count (:60) counts the literal string "\n type: A\n", so restyling the YAML to block form breaks all four tests with no behaviour change. Parse the YAML with serde_yaml and assert on the structure, or commit one snapshot per fixture.
- The same problem in a model test.
crates/natmap/tests/model.rs:42 add_mapping_request_serialize_defaults asserts json.contains("\"host_ip\":\"0.0.0.0\"") for the same reason. Deserialise and compare fields.
- Three port_binding tests parse a human-formatted table.
tests/auto_discover/port_binding.rs:220,261,306 use awk "$6 == id {print $8}" on natmap ls output. Reorder or re-pad a table column and all three break. Use the /rules JSON endpoint, or natmap ls --json if it exists.
- The same three tests are also duplicates.
bind_ip_strict_address (:196), bind_interface_resolved_address (:237) and bind_interface_overrides_defaults (:278) are 40 lines each, differing only in the YAML bind_ip: versus bind_interface: line and whether a defaults: block is present. One table-driven test.
- Two tests that do not test what they name.
src/cmd/cf2ansible.rs:271 output_produces_yaml never calls print_ansible_tasks_to; it calls parse_zone and checks the rtype list, while the real output is covered by tests/cf2ansible.rs. And ns_records_not_proxied (:301) is a for loop with an assert_eq! inside, so it passes vacuously if the fixture has no NS records.
- Test names break
standards.md §3.6. domain0, domain1, domain2, domain3 are named after the fixture file, with no module and no scenario.
Acceptance criteria
Blocked by
None (can start immediately).
Part of the whole-repo test-suite audit (2026-09-30). These are Fragile Fixtures: a formatting change breaks them with no behaviour change.
What to build
Tests that read the data the program produces, not the exact bytes it happened to emit.
Findings
tests/cf2ansible.rsasserts on exact YAML formatting.domain0(:74) carries about 20 assertions across 10 unrelated behaviours;domain3(:138) has 12;assert_common(:34) has 7.assert_type_count(:60) counts the literal string"\n type: A\n", so restyling the YAML to block form breaks all four tests with no behaviour change. Parse the YAML withserde_yamland assert on the structure, or commit one snapshot per fixture.crates/natmap/tests/model.rs:42 add_mapping_request_serialize_defaultsassertsjson.contains("\"host_ip\":\"0.0.0.0\"")for the same reason. Deserialise and compare fields.tests/auto_discover/port_binding.rs:220,261,306useawk "$6 == id {print $8}"onnatmap lsoutput. Reorder or re-pad a table column and all three break. Use the/rulesJSON endpoint, ornatmap ls --jsonif it exists.bind_ip_strict_address(:196),bind_interface_resolved_address(:237) andbind_interface_overrides_defaults(:278) are 40 lines each, differing only in the YAMLbind_ip:versusbind_interface:line and whether adefaults:block is present. One table-driven test.src/cmd/cf2ansible.rs:271 output_produces_yamlnever callsprint_ansible_tasks_to; it callsparse_zoneand checks the rtype list, while the real output is covered bytests/cf2ansible.rs. Andns_records_not_proxied(:301) is aforloop with anassert_eq!inside, so it passes vacuously if the fixture has no NS records.standards.md§3.6.domain0,domain1,domain2,domain3are named after the fixture file, with no module and no scenario.Acceptance criteria
ns_records_not_proxiedfails when the fixture is changed to have zero NS records, i.e. it is no longer vacuous<module_or_function>_<scenario>perstandards.md§3.6domain0becomes several named testscargo test -p lab-ops --test cf2ansiblepassesBlocked by
None (can start immediately).