From fc853622dd26475bace58c55e30baed2c8e89a0a Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Mon, 15 Jun 2020 21:13:19 +0200 Subject: [PATCH] more tests --- test_zfsautobackup.py | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/test_zfsautobackup.py b/test_zfsautobackup.py index b0a5cfe..381c212 100644 --- a/test_zfsautobackup.py +++ b/test_zfsautobackup.py @@ -186,8 +186,6 @@ test_target1/test_source2/fs2/sub@test-20101111000000 def test_nosnapshot(self): - # r=shelltest("zfs snapshot test_source1/fs1@othersimple") - # r=shelltest("zfs snapshot test_source1/fs1@otherdate-20001111000000") with patch('time.strftime', return_value="20101111000000"): self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-snapshot".split(" ")).run()) @@ -212,8 +210,6 @@ test_target1/test_source2/fs2 def test_nosend(self): - # r=shelltest("zfs snapshot test_source1/fs1@othersimple") - # r=shelltest("zfs snapshot test_source1/fs1@otherdate-20001111000000") with patch('time.strftime', return_value="20101111000000"): self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-send".split(" ")).run()) @@ -234,4 +230,37 @@ test_source2/fs2/sub@test-20101111000000 test_source2/fs3 test_source2/fs3/sub test_target1 +""") + + + def test_ignorereplicated(self): + r=shelltest("zfs snapshot test_source1/fs1@otherreplication") + + with patch('time.strftime', return_value="20101111000000"): + self.assertFalse(ZfsAutobackup("test test_target1 --verbose --ignore-replicated".split(" ")).run()) + + r=shelltest("zfs list -H -o name -r -t all") + #(only parents are created ) + #TODO: it probably shouldn't create these + self.assertMultiLineEqual(r,""" +test_source1 +test_source1/fs1 +test_source1/fs1@otherreplication +test_source1/fs1/sub +test_source1/fs1/sub@test-20101111000000 +test_source2 +test_source2/fs2 +test_source2/fs2/sub +test_source2/fs2/sub@test-20101111000000 +test_source2/fs3 +test_source2/fs3/sub +test_target1 +test_target1/test_source1 +test_target1/test_source1/fs1 +test_target1/test_source1/fs1/sub +test_target1/test_source1/fs1/sub@test-20101111000000 +test_target1/test_source2 +test_target1/test_source2/fs2 +test_target1/test_source2/fs2/sub +test_target1/test_source2/fs2/sub@test-20101111000000 """)