extract common stuff to prepare for zfs-autoverify

This commit is contained in:
Edwin Eefting
2022-01-17 21:19:40 +01:00
parent b36b64cc94
commit d114f63f29
4 changed files with 258 additions and 205 deletions

View File

@ -1,4 +1,4 @@
import zfs_autobackup.LogConsole
from zfs_autobackup.LogConsole import LogConsole
from basetest import *
@ -8,7 +8,7 @@ class TestLog(unittest2.TestCase):
"""test with color output"""
with OutputIO() as buf:
with redirect_stdout(buf):
l=LogConsole(show_verbose=False, show_debug=False, color=True)
l= LogConsole(show_verbose=False, show_debug=False, color=True)
l.verbose("verbose")
l.debug("debug")
@ -46,7 +46,7 @@ class TestLog(unittest2.TestCase):
self.assertEqual(list(buf.getvalue()), [' ', ' ', 'v', 'e', 'r', 'b', 'o', 's', 'e', '\n', '#', ' ', 'd', 'e', 'b', 'u', 'g', '\n', '!', ' ', 'e', 'r', 'r', 'o', 'r', '\n'])
zfs_autobackup.LogConsole.colorama=False
# zfs_autobackup.LogConsole.colorama=False

View File

@ -3,6 +3,8 @@ from zfs_autobackup.CmdPipe import CmdPipe
from basetest import *
import time
from zfs_autobackup.LogConsole import LogConsole
class TestZfsAutobackup(unittest2.TestCase):
@ -418,6 +420,33 @@ test_target1/fs2/sub
test_target1/fs2/sub@test-20101111000000
""")
# def test_strippath_toomuch(self):
# with patch('time.strftime', return_value="test-20101111000000"):
# self.assertFalse(
# ZfsAutobackup("test test_target1 --verbose --strip-path=2 --no-progress".split(" ")).run())
#
# r = shelltest("zfs list -H -o name -r -t all " + TEST_POOLS)
# 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
# test_target1/fs1
# test_target1/fs1@test-20101111000000
# test_target1/fs1/sub
# test_target1/fs1/sub@test-20101111000000
# test_target1/fs2
# test_target1/fs2/sub
# test_target1/fs2/sub@test-20101111000000
# """)
def test_clearrefres(self):