Skip to content

test(manage-parseus): kill mutation survivors in env-file and manifest helpers - #15

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

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

Conversation

@adamsrnmsu

Copy link
Copy Markdown
Collaborator

Description

Adds tests/test_manage_parseus_lib_survivors.py (53 tests, test-only change) covering the installer config loader, env-file helpers and manifest state helpers that mutation testing showed were under-tested: missing/directory config paths, blank config values, unreadable certificates, managed env-file fill/preserve, compose.env create/merge/no-op, health-threshold boundaries, image tag parsing, and manifest save/archive (no-op, history copy, name-collision suffix, sorted JSON with trailing newline). All tests use tmp_path/monkeypatch; no chown, Docker or network.

Mutation score (killed/total) before -> after:

File Before After
config/loader.py 30/68 37/68
install/env_files.py 32/59 55/59
state/manifest.py 11/29 28/29

Remaining loader.py survivors are in the port/HTTPS/certificate validation helpers, left for a follow-up. The four left in env_files.py/manifest.py are equivalent or near-equivalent mutants (listed in the commit message).

Related Issues/PRs

Type of Change

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

Checklist

Testing

  • Full suite: 21 failed, 566 passed, 1 error; the failures and error are the same Elasticsearch-server tests and macOS-only path test as on main (513 passed there).
  • Mutation scores above from the same mutator command before and after.

🤖 Generated with Claude Code

…t helpers

Adds tests/test_manage_parseus_lib_survivors.py covering behaviour of the
installer config loader, env-file helpers and manifest state helpers: config
path that is missing or a directory, blank config values, unreadable
certificate files, filling/preserving keys in managed env files, generating
the full set of env files (with and without gpib), health-threshold validation
boundaries (zero, one, equal warn/critical), compose.env create/merge/no-op,
public URL validation, PermissionError messaging, image tag parsing, manifest
save/archive (no-op, history copy, name collision suffix, sorted JSON with
trailing newline) and obsolete/purged image removal. Also covers a few
neighbouring helpers (parse_env_file quoting, fingerprint, manifest diffing,
utc_now_iso). All tests use tmp_path and monkeypatch; no chown, Docker or
network.

Mutation score (killed/total) before -> after: loader.py 30/68 -> 37/68,
env_files.py 32/59 -> 55/59, manifest.py 11/29 -> 28/29. Every survivor
named in the task is now killed. Remaining loader.py survivors are in
untouched port/health/certificate validation helpers outside this scope.

Equivalent or low-value survivors left: env_files.py:95 (or -> and in
parse_env_file's skip condition: a line lacking "=" is still skipped by the
later split, or yields the same dict), env_files.py:100/102 (len(v) >= 2
and 1 -> 0 guards: only differ for a single-character quoted value, where
the stripped result is the same), manifest.py:159 (isinstance tuple check
in normalize_for_fingerprint: the str() fallback hashes identically).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 survivor tests per PR #15 review

Strengthen three tests that still let mutants survive:

  • ensure_compose_env_file: seed an extra key ("C") so the merge
    must keep existing entries rather than replace the file, and
    assert that a call with no changes does not rewrite compose.env.
  • parse_env_file: make the comment line contain "=" so it only
    passes if comments are skipped before key=value parsing.
  • stable_config_fingerprint: assert that int and str values
    ({"a": 1} vs {"a": "1"}) produce different fingerprints.

Co-Authored-By: Claude noreply@anthropic.com

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamsrnmsu

Copy link
Copy Markdown
Collaborator Author

Took all three. The compose.env test now seeds C and fails if a no-op call rewrites the file, the comment line has an = in it, and the fingerprint test checks 1 vs "1". I broke the code each way to confirm the tests catch it now and didn't before. The manage-parseus tests all pass (165).

@GhostofGoes

Copy link
Copy Markdown

Horrifying, you're killing survivors?

@Ethane98
Ethane98 merged commit fda8d74 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.

3 participants