testsuite: add borg1_hardlink_master/slave/hardlinkable unit tests, refs #9556#9685
Open
mr-raj12 wants to merge 1 commit into
Open
testsuite: add borg1_hardlink_master/slave/hardlinkable unit tests, refs #9556#9685mr-raj12 wants to merge 1 commit into
mr-raj12 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9685 +/- ##
=======================================
Coverage 83.87% 83.87%
=======================================
Files 93 93
Lines 15586 15586
Branches 2335 2335
=======================================
Hits 13073 13073
Misses 1785 1785
Partials 728 728 ☔ View full report in Codecov by Sentry. |
Comment on lines
+64
to
+71
| def test_hardlink_master_false_when_source_present(): | ||
| item = _item(hardlink_master=True, source="dir/original") | ||
| assert not borg1_hardlink_master(item) | ||
|
|
||
|
|
||
| def test_hardlink_master_false_when_mode_not_hardlinkable(): | ||
| item = _item(hardlink_master=True, mode=stat.S_IFLNK | 0o777) | ||
| assert not borg1_hardlink_master(item) |
Member
There was a problem hiding this comment.
These are a bit curious cases. But I'ld hope the code never produces such items.
Comment on lines
+93
to
+102
| def test_hardlink_slave_false_when_mode_not_hardlinkable(): | ||
| item = _item(source="dir/original", mode=stat.S_IFLNK | 0o777) | ||
| assert not borg1_hardlink_slave(item) | ||
|
|
||
|
|
||
| def test_master_and_slave_are_mutually_exclusive(): | ||
| # source present means master check fails; slave check wins | ||
| item = _item(hardlink_master=True, source="dir/original") | ||
| assert not borg1_hardlink_master(item) | ||
| assert borg1_hardlink_slave(item) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Unit tests for
borg1_hardlinkable,borg1_hardlink_master, andborg1_hardlink_slave, refs #9556.legacy/helpers.pyhas three predicates thatUpgraderFrom12To20.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 addssrc/borg/testsuite/legacy_helpers_test.pywith 18 tests covering all three.src/borg/testsuite/legacy_helpers_test.py-- 18 tests:borg1_hardlinkable(7 tests):borg1_hardlink_master(5 tests):hardlink_masterkey absent → Falsehardlink_master=False→ Falsesourcepresent (even withhardlink_master=True) → Falseborg1_hardlink_slave(6 tests):sourcepresent, regular file → Truesourcepresent, FIFO (non-regular hardlinkable type) → Truesource→ Falsehardlink_master=Trueandsource: master=False, slave=True (mutual exclusion documented)Refs #9556
Checklist
mastertoxor the relevant test subset)