From a6cdd4b89e136dc9e735b89245bc5ae86f9e8037 Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Wed, 8 Jul 2020 17:07:21 +0200 Subject: [PATCH] fixes and more tests --- test_externalfailures.py | 2 +- test_zfsautobackup.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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"):