From 2d42d1d1a5da783c746c6492b8bccaa5fc0b8e6d Mon Sep 17 00:00:00 2001 From: Edwin Eefting <edwin@datux.nl> Date: Mon, 21 Feb 2022 14:02:45 +0100 Subject: [PATCH] forgot a test --- tests/test_check.py | 26 +++++++++++++------------- zfs_autobackup/ZfsCheck.py | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_check.py b/tests/test_check.py index db8f72b..84a7036 100644 --- a/tests/test_check.py +++ b/tests/test_check.py @@ -111,19 +111,19 @@ dir/testfile 0 2e863f1fcccd6642e4e28453eba10d2d3f74d798 """, buf.getvalue()) - # def test_brokenpipe_cleanup_filesystem(self): - # """test if stuff is cleaned up correctly, in debugging mode , when a pipe breaks. """ - # - # prepare_zpools() - # shelltest("cp tests/data/whole /test_source1/testfile") - # shelltest("zfs snapshot test_source1@test") - # - # #breaks pipe when grep exists: - # #important to use --debug, since that generates extra output which would be problematic if we didnt do correct SIGPIPE handling - # shelltest("python -m zfs_autobackup.ZfsCheck test_source1@test --debug | grep -m1 'Hashing tree'") - # - # #should NOT be mounted anymore if cleanup went ok: - # self.assertNotRegex(shelltest("mount"), "test_source1@test") + def test_brokenpipe_cleanup_filesystem(self): + """test if stuff is cleaned up correctly, in debugging mode , when a pipe breaks. """ + + prepare_zpools() + shelltest("cp tests/data/whole /test_source1/testfile") + shelltest("zfs snapshot test_source1@test") + + #breaks pipe when grep exists: + #important to use --debug, since that generates extra output which would be problematic if we didnt do correct SIGPIPE handling + shelltest("python -m zfs_autobackup.ZfsCheck test_source1@test --debug | grep -m1 'Hashing tree'") + + #should NOT be mounted anymore if cleanup went ok: + self.assertNotRegex(shelltest("mount"), "test_source1@test") def test_brokenpipe_cleanup_volume(self): diff --git a/zfs_autobackup/ZfsCheck.py b/zfs_autobackup/ZfsCheck.py index 782be91..283762c 100644 --- a/zfs_autobackup/ZfsCheck.py +++ b/zfs_autobackup/ZfsCheck.py @@ -31,7 +31,7 @@ class ZfsCheck(CliBase): group.add_argument('--block-size', metavar="BYTES", default=4096, help="Read block-size, default %(default)s", type=int) group.add_argument('--count', metavar="COUNT", default=int((100 * (1024 ** 2)) / 4096), - help="Generate a hash for every COUNT blocks. default %(default)s", type=int) # 100MiB + help="Hash chunks of COUNT blocks. Default %(default)s . (Chunk size is BYTES * COUNT) ", type=int) # 100MiB group.add_argument('--check', '-c', metavar="FILE", default=None, help="Read hashes from FILE and check them")