Skip to content

tests: corrupt chunks at store level in check tests#9826

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:check-tests-corrupt-at-store-level
Jun 29, 2026
Merged

tests: corrupt chunks at store level in check tests#9826
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:check-tests-corrupt-at-store-level

Conversation

@mr-raj12

@mr-raj12 mr-raj12 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

These check tests faked chunk corruption with get(), a byte flip, then put(). The put() reframes the object through PackWriter into a fresh valid pack, so the store-level sha256 check never trips, and the flipped byte lands at a layout-dependent offset. That was flaky on Windows.

test_verify_data, test_corrupted_file_chunk and test_manifest_rebuild_corrupted_chunk now corrupt the chunk in the on-disk pack via corrupt_chunk_on_disk, which breaks both the store-level sha256 name and the crypto MAC.

The manifest-corruption tests previously overwrote a byte with a fixed value. That is a no-op whenever the byte already held that value, which for encrypted data happens ~1/256 of the time and caused intermittent failures. They now use a corrupt() helper that flips all bits of one byte instead.

test_manifest_rebuild_corrupted_chunk and test_empty_repository are skipped with a TODO: repair does not yet rewrite store-corrupted packs (#8572).

test_spoofed_archive and test_extra_chunks get a repository.flush() so the put is durable before the following check.

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.19%. Comparing base (2dcb50f) to head (3b3a647).
⚠️ Report is 7 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9826      +/-   ##
==========================================
- Coverage   85.23%   85.19%   -0.04%     
==========================================
  Files          92       92              
  Lines       15297    15303       +6     
  Branches     2299     2300       +1     
==========================================
- Hits        13038    13037       -1     
- Misses       1570     1578       +8     
+ Partials      689      688       -1     

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

Comment thread src/borg/testsuite/archiver/check_cmd_test.py Outdated
Comment thread src/borg/testsuite/archiver/check_cmd_test.py
@mr-raj12 mr-raj12 force-pushed the check-tests-corrupt-at-store-level branch from 732960c to 8bd1bfd Compare June 28, 2026 19:36
Comment thread src/borg/testsuite/archiver/check_cmd_test.py Outdated
test_manifest_rebuild_corrupted_chunk now corrupts the pack at the
store level and is skipped (TODO borgbackup#8572) until repair rewrites
store-corrupted packs.
@mr-raj12 mr-raj12 force-pushed the check-tests-corrupt-at-store-level branch from 8bd1bfd to 3b3a647 Compare June 29, 2026 01:46

@ThomasWaldmann ThomasWaldmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, the PR comment needs to be updated.

@ThomasWaldmann ThomasWaldmann merged commit 467d37e into borgbackup:master Jun 29, 2026
18 of 19 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