Repository navigation
test(manage-parseus): kill mutation survivors in config and manifest helpers - #12
Merged
Ethane98 merged 2 commits intoNov 19, 2026
Merged
Conversation
…helpers Problem: a mutation run over manage_parseus_lib/config/loader.py, install/env_files.py and state/manifest.py showed the existing tests executed these functions without asserting their outcomes. For example apply_compose_nginx_network_defaults killed 1 of 11 mutants and parse_env_file 11 of 25. Cause: coverage came from a few end-to-end build_installer_config tests; the quote/escape parsing, port and certificate boundaries, fingerprint output and manifest comparison had no direct assertions. Fix: add tests/test_manage_parseus_lib_config_state.py with behaviour tests for apply_compose_nginx_network_defaults, parse_config_port, validate_installer_config_values, parse_env_file, manifests_differ_meaningfully, stable_config_fingerprint, normalize_for_fingerprint and utc_now_iso. Tests only; no source change, and no real bug was revealed. Mutants still alive in the targeted functions are equivalent: - loader.py f.read(1) -> f.read(0): open() already raises on an unreadable file, so the read size is unobservable. (Also unreachable: the `not str(cert_path).strip()` operand in the cert path check, since str(Path) is never blank.) Verified (mutator, killed/total, before -> after, tests test_manage_parseus_lib.py + new file): - apply_compose_nginx_network_defaults 1/11 -> 11/11 - parse_env_file 11/25 -> 25/25 - validate_installer_config_values 11/30 -> 29/30 - manifests_differ_meaningfully 1/5 -> 5/5 - parse_config_port 2/5 -> 5/5 - normalize_for_fingerprint 0/1 -> 1/1 - stable_config_fingerprint 0/1 -> 1/1 - utc_now_iso 0/1 -> 1/1 - Full suite on macOS: 21 failed, 1 error before and after (all Elasticsearch-server tests plus the macOS-only test_build_paths_uses_var_lib_for_manifest_state); 619 passed after. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
6 of 11 tasks
Ethane98
requested changes
Nov 17, 2026
Ethane98
left a comment
Collaborator
There was a problem hiding this comment.
test(manage-parseus): tighten loose assertions in config/state tests
Review follow-up to the mutation-survivor tests; tests only, no source
change.
- test_nginx_defaults_reject_bad_port: require the message to end with the rejected value instead of a substring check joined with
or. - test_validate_certificate_files: match the full "cert_file: must be a non-empty path" message rather than just "cert_file".
- test_validate_rejects_empty_required_strings: add match="must not be empty" to the bare pytest.raises.
- test_validate_accepts_unusual_but_printable_common_name: write "a b\x20c" as the identical "a b c" for readability.
Verified: the new file and test_manage_parseus_lib.py pass (218 passed); mutant kill results are unchanged.
Co-Authored-By: Claude noreply@anthropic.com
Review follow-up (Ethane98) to the mutation-survivor tests; tests only, no source change. - test_nginx_defaults_reject_bad_port: the message must end with the rejected value, instead of a substring check joined with `or`. - test_validate_accepts_unusual_but_printable_common_name: spell the boundary as a plain space and say why it is there (0x20 is the lowest character the control-character check allows). - test_validate_certificate_files: match the full "must be a non-empty path" message for a str cert_file. - test_validate_rejects_empty_required_strings: match "must not be empty". Proved: tests/test_manage_parseus_lib_config_state.py and tests/test_manage_parseus_lib.py, 217 passed, 1 skipped, run as root in python:3.12-slim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A mutation run over
manage_parseus_lib(config/loader.py,install/env_files.py,state/manifest.py) showed the existing tests executed these helpers without asserting their results; for exampleapply_compose_nginx_network_defaultskilled 1 of 11 mutants. This addstests/test_manage_parseus_lib_config_state.pywith behaviour tests for the weakest functions. Tests only; no source change, and no real bug turned up.Related Issues/PRs
Type of Change
fix)feat)docs)refactor)chore)Checklist
Testing
Mutants killed/total per function, before and after:
apply_compose_nginx_network_defaultsparse_env_filevalidate_installer_config_valuesmanifests_differ_meaningfullyparse_config_portnormalize_for_fingerprint,stable_config_fingerprint,utc_now_isoThe one survivor left in
validate_installer_config_valuesis equivalent:f.read(1)tof.read(0)cannot be observed, sinceopen()already raises on an unreadable file.mainand no new ones (Elasticsearch-server tests, plus the macOS-onlytest_build_paths_uses_var_lib_for_manifest_state).Additional Notes
Other survivors in the same three files, outside these functions, are left for a follow-up. The unreadable-certificate test is skipped when running as root.
🤖 Generated with Claude Code