Skip to content

test(manage-parseus): kill mutation survivors in config and manifest helpers - #12

Merged
Ethane98 merged 2 commits into
sandialabs:mainfrom
adamsrnmsu:test-manage-parseus-lib-mutants
Nov 19, 2026
Merged

Ethane98 merged 2 commits into
sandialabs:mainfrom
adamsrnmsu:test-manage-parseus-lib-mutants

Conversation

@adamsrnmsu

Copy link
Copy Markdown
Collaborator

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 example apply_compose_nginx_network_defaults killed 1 of 11 mutants. This adds tests/test_manage_parseus_lib_config_state.py with behaviour tests for the weakest functions. Tests only; no source change, and no real bug turned up.

Related Issues/PRs

  • None; no overlap with other open PRs.

Type of Change

  • Bugfix (fix)
  • Feature (feat)
  • Documentation (docs)
  • Refactor (refactor)
  • Chore (CI, build, dependencies, etc.) (chore)
  • Other (please describe): tests only

Checklist

Testing

Mutants killed/total per function, before and after:

Function Before After
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, stable_config_fingerprint, utc_now_iso 0/1 each 1/1 each

The one survivor left in validate_installer_config_values is equivalent: f.read(1) to f.read(0) cannot be observed, since open() already raises on an unreadable file.

  • Full suite on macOS without an Elasticsearch server: the same failures as main and no new ones (Elasticsearch-server tests, plus the macOS-only test_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

…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>

@Ethane98 Ethane98 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@Ethane98
Ethane98 merged commit 20346e4 into sandialabs:main Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants