From b7b2723b2e23af58cb08d2a00ec371069b4486d3 Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Sun, 18 Apr 2021 22:47:53 +0200 Subject: [PATCH] coverage --- tests/test_zfsautobackup.py | 25 +++++++++++++++++++++++++ zfs_autobackup/ZfsDataset.py | 3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/test_zfsautobackup.py b/tests/test_zfsautobackup.py index 2ddff07..8b33839 100644 --- a/tests/test_zfsautobackup.py +++ b/tests/test_zfsautobackup.py @@ -1,3 +1,4 @@ +from CmdPipe import CmdPipe from basetest import * import time @@ -884,3 +885,27 @@ test_target1/test_source2/fs2/sub@test-20101111000003 def test_raw(self): self.skipTest("todo: later when travis supports zfs 0.8") + + + def test_progress(self): + + r=shelltest("dd if=/dev/zero of=/test_source1/data.txt bs=200000 count=1") + r = shelltest("zfs snapshot test_source1@test") + + l=LogConsole(show_verbose=True, show_debug=False, color=False) + n=ZfsNode("test",l) + d=ZfsDataset(n,"test_source1@test") + + sp=d.send_pipe([], prev_snapshot=None, resume_token=None, show_progress=True, raw=False) + + + with OutputIO() as buf: + with redirect_stderr(buf): + try: + n.run(["sleep", "2"], inp=sp) + except: + pass + + print(buf.getvalue()) + # correct message? + self.assertRegex(buf.getvalue(),".*>>> .*minutes left.*") diff --git a/zfs_autobackup/ZfsDataset.py b/zfs_autobackup/ZfsDataset.py index 57677c6..5e2525a 100644 --- a/zfs_autobackup/ZfsDataset.py +++ b/zfs_autobackup/ZfsDataset.py @@ -494,14 +494,13 @@ class ZfsDataset: return self.from_names(names[1:]) - def send_pipe(self, features, prev_snapshot, resume_token, show_progress, raw, output_pipes): + def send_pipe(self, features, prev_snapshot, resume_token, show_progress, raw): """returns a pipe with zfs send output for this snapshot resume_token: resume sending from this token. (in that case we don't need to know snapshot names) Args: - :type output_pipes: list of str :type features: list of str :type prev_snapshot: ZfsDataset :type resume_token: str