diff --git a/test_externalfailures.py b/test_externalfailures.py index 7521532..e084a53 100644 --- a/test_externalfailures.py +++ b/test_externalfailures.py @@ -30,7 +30,7 @@ class TestZfsNode(unittest2.TestCase): #free up space r=shelltest("rm /test_target1/waste") - r=shelltest("zpool sync") + r=shelltest("zfs umount test_target1") #should resume and succeed with io.StringIO() as buf: diff --git a/test_zfsautobackup.py b/test_zfsautobackup.py index 64fb58b..f2963e7 100644 --- a/test_zfsautobackup.py +++ b/test_zfsautobackup.py @@ -1,5 +1,7 @@ from basetest import * import time +import contextlib +import io @@ -11,6 +13,19 @@ class TestZfsAutobackup(unittest2.TestCase): def test_defaults(self): + with self.subTest("no datasets selected"): + #should resume and succeed + + with io.StringIO() as buf: + with contextlib.redirect_stderr(buf): + with patch('time.strftime', return_value="20101111000000"): + self.assertTrue(ZfsAutobackup("nonexisting test_target1 --verbose --debug".split(" ")).run()) + + print(buf.getvalue()) + #did we really resume? + self.assertIn("No source filesystems selected", buf.getvalue()) + + with self.subTest("defaults with full verbose and debug"): with patch('time.strftime', return_value="20101111000000"):