zfs-check broken pipe handling tests

This commit is contained in:
Edwin Eefting
2022-02-21 12:31:19 +01:00
parent ed61f03b4b
commit 3e6a327647
5 changed files with 25 additions and 8 deletions

View File

@ -107,7 +107,21 @@ 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. """
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")
#should NOT be mounted anymore if cleanup went ok:
self.assertNotRegex(shelltest("mount"), "test_source1@test")