mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-06-05 01:33:00 +03:00
more tests
This commit is contained in:
parent
ff33f46cb8
commit
37a9f49d8d
@ -1707,7 +1707,8 @@ class ZfsAutobackup:
|
|||||||
target_datasets.append(target_dataset)
|
target_datasets.append(target_dataset)
|
||||||
|
|
||||||
#ensure parents exists
|
#ensure parents exists
|
||||||
if not self.args.no_send and not target_dataset.parent.exists:
|
#TODO: this isnt perfect yet, in some cases it can create parents when it shouldn't.
|
||||||
|
if not self.args.no_send and not target_dataset.parent in target_datasets and not target_dataset.parent.exists:
|
||||||
target_dataset.parent.create_filesystem(parents=True)
|
target_dataset.parent.create_filesystem(parents=True)
|
||||||
|
|
||||||
#determine common zpool features
|
#determine common zpool features
|
||||||
|
@ -5,6 +5,7 @@ class TestZfsAutobackup(unittest2.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
prepare_zpools()
|
prepare_zpools()
|
||||||
|
self.longMessage=True
|
||||||
|
|
||||||
def test_defaults(self):
|
def test_defaults(self):
|
||||||
|
|
||||||
@ -183,3 +184,54 @@ test_target1/test_source2/fs2/sub
|
|||||||
test_target1/test_source2/fs2/sub@test-20101111000000
|
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())
|
||||||
|
|
||||||
|
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/sub
|
||||||
|
test_source2
|
||||||
|
test_source2/fs2
|
||||||
|
test_source2/fs2/sub
|
||||||
|
test_source2/fs3
|
||||||
|
test_source2/fs3/sub
|
||||||
|
test_target1
|
||||||
|
test_target1/test_source1
|
||||||
|
test_target1/test_source2
|
||||||
|
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())
|
||||||
|
|
||||||
|
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@test-20101111000000
|
||||||
|
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
|
||||||
|
""")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user