fix #190. --exclude-received now expects number of bytes instead that have to be changed for a dataset to not get excluded. (default 0)

this also makes it so that it doesnt conflict with --allow-empty.

added regression tests for exclude-unchanged as well.
This commit is contained in:
Edwin Eefting
2023-04-04 14:10:58 +02:00
parent ab43689a0f
commit cdd151d45f
8 changed files with 71 additions and 33 deletions

View File

@ -95,3 +95,25 @@ test_target1/fs1@test-20101111000000
test_target1/fs1/sub@test-20101111000000
test_target1/fs2/sub@test-20101111000000
""")
def test_exclude_unchanged(self):
shelltest("zfs snapshot -r test_source1@somesnapshot")
with patch('time.strftime', return_value="test-20101111000000"):
self.assertFalse(
ZfsAutobackup(
"test test_target1 --verbose --allow-empty --exclude-unchanged=1".split(" ")).run())
#everything should be excluded, but should not return an error (see #190)
with patch('time.strftime', return_value="test-20101111000001"):
self.assertFalse(
ZfsAutobackup(
"test test_target1 --verbose --allow-empty --exclude-unchanged=1".split(" ")).run())
r = shelltest("zfs list -H -o name -r -t snapshot test_target1")
self.assertMultiLineEqual(r, """
test_target1/test_source2/fs2/sub@test-20101111000000
""")