Skip to content

testsuite: decouple legacyrepository_test from RepoObj, refs #8572#9687

Merged
ThomasWaldmann merged 2 commits into
borgbackup:masterfrom
mr-raj12:pack-files-decouple-legacy-tests
May 31, 2026
Merged

testsuite: decouple legacyrepository_test from RepoObj, refs #8572#9687
ThomasWaldmann merged 2 commits into
borgbackup:masterfrom
mr-raj12:pack-files-decouple-legacy-tests

Conversation

@mr-raj12
Copy link
Copy Markdown
Contributor

@mr-raj12 mr-raj12 commented May 30, 2026

Description

legacyrepository_test was importing RepoObj (borg 2) to build test blobs in fchunk/pchunk. That coupling was wrong: borg 1.x blobs have a 1-byte compressor type header followed by the payload, not the Struct("<II") meta/data header from borg 2.

Remove the RepoObj import. fchunk now prepends a 1-byte CNONE type header (0x00) to simulate the generic borg 1.x blob format without real compression. pchunk strips that byte. test_max_data_size updated to account for the 1-byte overhead.

This way, changes to the borg 2 blob format (e.g. OBJ_MAGIC in #9684) no longer touch the legacy test helpers.

refs #8572

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (run tox or the relevant test subset)
  • Commit messages are clean and reference related issues

@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.88%. Comparing base (7f43779) to head (a0494b2).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9687   +/-   ##
=======================================
  Coverage   83.87%   83.88%           
=======================================
  Files          93       93           
  Lines       15586    15586           
  Branches     2335     2335           
=======================================
+ Hits        13073    13074    +1     
  Misses       1785     1785           
+ Partials      728      727    -1     

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

Copy link
Copy Markdown
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

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

The idea is:

  • fchunk(data, meta) -> chunk_content -> repo put
  • repo get -> pchunk -> data, meta

That fchunk/pchunk is just a simplified way to do something close to what borg usually does, but without having to set up compression and encryption.

Comment thread src/borg/testsuite/legacyrepository_test.py Outdated
Comment thread src/borg/testsuite/legacyrepository_test.py Outdated
Copy link
Copy Markdown
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

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

LGTM.

@ThomasWaldmann ThomasWaldmann merged commit f923281 into borgbackup:master May 31, 2026
20 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