This commit is contained in:
Edwin Eefting 2021-04-18 22:47:53 +02:00
parent ec1d3ff93e
commit b7b2723b2e
2 changed files with 26 additions and 2 deletions

View File

@ -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.*")

View File

@ -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