Skip to content

Add unit tests for PermMapper (toMode parsing, constructors, ownership/mode mapping) - #919

Merged
tcurdt merged 1 commit into
tcurdt:masterfrom
vasiliy-mikhailov:add-permmapper-tests
Jun 30, 2026
Merged

Add unit tests for PermMapper (toMode parsing, constructors, ownership/mode mapping)#919
tcurdt merged 1 commit into
tcurdt:masterfrom
vasiliy-mikhailov:add-permmapper-tests

Conversation

@vasiliy-mikhailov

@vasiliy-mikhailov vasiliy-mikhailov commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

PermMapperTest currently covers only entry-name mapping. This adds tests for the rest of PermMapper:

  • toMode(String) octal parsing, including null/empty → -1
  • both the String- and int-mode constructors and their defaults
  • map(...) setting uid/gid/user/group and file-vs-dir modes, with edge cases (uid/gid 0 and -1, null user/group preserving existing values, strip, prefix)

All additive — no existing test changed, no production code changed. Raises PermMapper line coverage from ~78% to 100%. Verified green under Java 8 (mvn test -Dtest=PermMapperTest).


How this was produced

This PR was generated with an AI-assisted pipeline built around mutation testing (PIT). The pipeline mutates the target class (flipping conditions and changing boundary/edge cases) and runs the existing tests against each mutant. Where a mutant survives (the existing tests do not catch that edge case), it writes a focused test for that case and reruns PIT to confirm the new test actually kills that specific mutant. So every added test is verified to catch a concrete edge case the suite missed before, rather than being speculative or redundant. The change is additive only (no production code modified), and the module builds green under its CI JDK.

…p/mode mapping)

PermMapperTest previously covered only entry-name mapping. This adds tests for
the rest of PermMapper: toMode(String) octal parsing including null/empty -> -1,
both the String- and int-mode constructors and their defaults, and map(...)
setting uid/gid/user/group and file-vs-dir modes with edge cases (uid/gid 0 and
-1, null user/group preserving existing values, strip, prefix).

Additive only - no existing test or production code changed.
@codecov-commenter

codecov-commenter commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.15%. Comparing base (92fee05) to head (12de5d5).
⚠️ Report is 270 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #919      +/-   ##
============================================
+ Coverage     71.03%   74.15%   +3.11%     
- Complexity       96      119      +23     
============================================
  Files             7        8       +1     
  Lines           580      619      +39     
  Branches         75       82       +7     
============================================
+ Hits            412      459      +47     
+ Misses          121      107      -14     
- Partials         47       53       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tcurdt

tcurdt commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution. Is there a particular reason why you added the tests?

@vasiliy-mikhailov

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look. The reason: PIT mutation testing showed the existing PermMapper tests executed the class but only caught 9 of 81 mutations (about 11% mutation score), so most of the toMode parsing and ownership/mode-mapping behaviour was run but never actually asserted. These are append-only characterization tests (no production change) that pin that current behaviour, taking the mutation score to 66/81 (about 81%) and line coverage to 100%, so a future refactor cannot silently change it. They are not bug reports, just regression guards. Happy to drop any that do not fit.

@tcurdt

tcurdt commented Jun 30, 2026

Copy link
Copy Markdown
Owner

All good. I was just surprised. Test coverage is just not a common contribution.

@tcurdt
tcurdt merged commit 4053159 into tcurdt:master Jun 30, 2026
13 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