Skip to content

testsuite: add borg1_hardlink_master/slave/hardlinkable unit tests, refs #9556#9685

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:testsuite-legacy-helpers
May 31, 2026
Merged

testsuite: add borg1_hardlink_master/slave/hardlinkable unit tests, refs #9556#9685
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
mr-raj12:testsuite-legacy-helpers

Conversation

@mr-raj12
Copy link
Copy Markdown
Contributor

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

Description

Unit tests for borg1_hardlinkable, borg1_hardlink_master, and borg1_hardlink_slave, refs #9556.

legacy/helpers.py has three predicates that UpgraderFrom12To20.upgrade_item() uses to tell hardlink masters from slaves from regular items. PR #9675 tests the upgrade flow end to end, but these predicates themselves had no coverage. This PR adds src/borg/testsuite/legacy_helpers_test.py with 13 tests covering all three.

src/borg/testsuite/legacy_helpers_test.py -- 13 tests:

borg1_hardlinkable (7 tests):

  • regular file → True
  • block device → True
  • char device → True
  • FIFO → True
  • symlink → False
  • directory → False
  • socket → False

borg1_hardlink_master (3 tests):

  • all conditions met → True
  • hardlink_master key absent → False
  • hardlink_master=False → False

borg1_hardlink_slave (3 tests):

  • source present, regular file → True
  • source present, FIFO (non-regular hardlinkable type) → True
  • no source → False

Refs #9556

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests (this PR is the tests)
  • 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.95%. Comparing base (7f43779) to head (de5590f).
⚠️ Report is 17 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9685      +/-   ##
==========================================
+ Coverage   83.87%   83.95%   +0.07%     
==========================================
  Files          93       93              
  Lines       15586    15586              
  Branches     2335     2335              
==========================================
+ Hits        13073    13085      +12     
+ Misses       1785     1775      -10     
+ Partials      728      726       -2     

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

Comment thread src/borg/testsuite/legacy_helpers_test.py Outdated
Comment thread src/borg/testsuite/legacy_helpers_test.py Outdated
@mr-raj12 mr-raj12 force-pushed the testsuite-legacy-helpers branch from 85ed3e9 to aa4b529 Compare May 31, 2026 14:47
@mr-raj12 mr-raj12 force-pushed the testsuite-legacy-helpers branch from aa4b529 to de5590f Compare May 31, 2026 14:50
@ThomasWaldmann ThomasWaldmann merged commit 504be79 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