Skip to content

Add deterministic archive generation and checksum verification tests#1826

Open
ducminh02 wants to merge 11 commits intodevonfw:mainfrom
ducminh02:1447-cover-checksum-verification-junit
Open

Add deterministic archive generation and checksum verification tests#1826
ducminh02 wants to merge 11 commits intodevonfw:mainfrom
ducminh02:1447-cover-checksum-verification-junit

Conversation

@ducminh02
Copy link
Copy Markdown
Contributor

@ducminh02 ducminh02 commented Apr 16, 2026

Cover checksum verification in JUnit

This PR fixes #1447

Implemented changes:

  • Cross-Platform Archive Determinism: Fixed FileAccessImpl to ensure ZIP and TAR.GZ archives are binary-identical across OS by sorting entries and zeroing out timestamps.

  • Checksum Verification Tests: Added the first-time JUnit coverage for AbstractToolRepository to verify SHA-256 validation and security aborts.

  • Added ArchiveDeterminismTest to verify byte-for-byte reproducibility of archives.

  • Added ChecksumVerificationTest to verify the security gatekeeper logic (covering both matching hashes and mismatch failures).


Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 16, 2026

Coverage Report for CI Build 25378019331

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.4%) to 71.041%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 241 coverage regressions across 9 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

241 previously-covered lines in 9 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/io/FileAccessImpl.java 166 69.42%
com/devonfw/tools/ide/tool/ToolCommandlet.java 45 73.6%
com/devonfw/tools/ide/url/updater/UpdateManager.java 13 0.0%
com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java 8 90.36%
com/devonfw/tools/ide/tool/intellij/Intellij.java 3 89.29%
com/devonfw/tools/ide/tool/ToolEditionAndVersion.java 2 82.81%
com/devonfw/tools/ide/url/tool/intellij/IntellijUrlUpdater.java 2 93.1%
com/devonfw/tools/ide/common/Tag.java 1 98.17%
com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java 1 78.33%

Coverage Stats

Coverage Status
Relevant Lines: 15410
Covered Lines: 11413
Line Coverage: 74.06%
Relevant Branches: 6880
Covered Branches: 4422
Branch Coverage: 64.27%
Branches in Coverage %: Yes
Coverage Strength: 3.13 hits per line

💛 - Coveralls

@ducminh02 ducminh02 marked this pull request as ready for review April 16, 2026 09:38
@ducminh02 ducminh02 moved this from 🆕 New to Team Review in IDEasy board Apr 16, 2026
@satorus satorus self-requested a review April 22, 2026 08:09
@satorus satorus self-assigned this Apr 22, 2026
Comment thread cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java
Comment thread cli/src/test/java/com/devonfw/tools/ide/io/ArchiveDeterminismTest.java Outdated
fileAccess.compressZip(contentDir, out1);
}
// Wait a bit to ensure a non-deterministic time would change
Thread.sleep(1100);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same as in the tarGz test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

same as in the tarGz test

Comment thread CHANGELOG.adoc Outdated
@ducminh02 ducminh02 moved this from Team Review to 👀 In review in IDEasy board May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Cover checksum verification in JUnit

4 participants