working on send pipe
This commit is contained in:
33
tests/test_sendrecvpipes.py
Normal file
33
tests/test_sendrecvpipes.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
from basetest import *
|
||||||
|
import time
|
||||||
|
|
||||||
|
class TestSendRecvPipes(unittest2.TestCase):
|
||||||
|
"""test input/output pipes for zfs send and recv"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
prepare_zpools()
|
||||||
|
self.longMessage=True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_send_basics(self):
|
||||||
|
"""send basics (remote/local send pipe)"""
|
||||||
|
|
||||||
|
with patch('time.strftime', return_value="20101111000000"):
|
||||||
|
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--send-pipe=dd bs=1M", "--send-pipe=dd bs=2M"]).run())
|
||||||
|
|
||||||
|
with patch('time.strftime', return_value="20101111000001"):
|
||||||
|
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--ssh-source=localhost", "--send-pipe=dd bs=1M", "--send-pipe=dd bs=2M"]).run())
|
||||||
|
|
||||||
|
# r=shelltest("zfs list -H -o name -r -t snapshot test_target1")
|
||||||
|
# #NOTE: it wont backup test_target1/a/test_source2/fs2/sub to test_target1/b since it doesnt have the zfs_autobackup property anymore.
|
||||||
|
# self.assertMultiLineEqual(r,"""
|
||||||
|
# test_target1/a/test_source1/fs1@test-20101111000000
|
||||||
|
# test_target1/a/test_source1/fs1/sub@test-20101111000000
|
||||||
|
# test_target1/a/test_source2/fs2/sub@test-20101111000000
|
||||||
|
# test_target1/b/test_source1/fs1@test-20101111000000
|
||||||
|
# test_target1/b/test_source1/fs1/sub@test-20101111000000
|
||||||
|
# test_target1/b/test_source2/fs2/sub@test-20101111000000
|
||||||
|
# test_target1/b/test_target1/a/test_source1/fs1@test-20101111000000
|
||||||
|
# test_target1/b/test_target1/a/test_source1/fs1/sub@test-20101111000000
|
||||||
|
# """)
|
||||||
@ -2,6 +2,7 @@ from basetest import *
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
class TestZfsAutobackup31(unittest2.TestCase):
|
class TestZfsAutobackup31(unittest2.TestCase):
|
||||||
|
"""various new 3.1 features"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
prepare_zpools()
|
prepare_zpools()
|
||||||
|
|||||||
@ -557,20 +557,19 @@ class ZfsDataset:
|
|||||||
cmd.append(self.name)
|
cmd.append(self.name)
|
||||||
|
|
||||||
# #add custom output pipes?
|
# #add custom output pipes?
|
||||||
# if output_pipes:
|
#local so do our own piping
|
||||||
# #local so do our own piping
|
if self.zfs_node.is_local():
|
||||||
# if self.zfs_node.is_local():
|
output_pipe = self.zfs_node.run(cmd, pipe=True, readonly=True)
|
||||||
# output_pipe = self.zfs_node.run(cmd)
|
for pipe_cmd in output_pipes:
|
||||||
# for pipe_cmd in output_pipes:
|
output_pipe=self.zfs_node.run(pipe_cmd.split(" "), inp=output_pipe, pipe=True, readonly=False)
|
||||||
# output_pipe=self.zfs_node.run(pipe_cmd, inp=output_pipe, )
|
#remote, so add with actual | and let remote shell handle it
|
||||||
# return output_pipe
|
else:
|
||||||
# #remote, so add with actual | and let remote shell handle it
|
for pipe_cmd in output_pipes:
|
||||||
# else:
|
cmd.append("|")
|
||||||
# for pipe_cmd in output_pipes:
|
cmd.extend(pipe_cmd.split(" "))
|
||||||
# cmd.append("|")
|
output_pipe = self.zfs_node.run(cmd, pipe=True, readonly=True)
|
||||||
# cmd.extend(pipe_cmd)
|
|
||||||
|
|
||||||
return self.zfs_node.run(cmd, pipe=True, readonly=True)
|
return output_pipe
|
||||||
|
|
||||||
def recv_pipe(self, pipe, features, filter_properties=None, set_properties=None, ignore_exit_code=False):
|
def recv_pipe(self, pipe, features, filter_properties=None, set_properties=None, ignore_exit_code=False):
|
||||||
"""starts a zfs recv for this snapshot and uses pipe as input
|
"""starts a zfs recv for this snapshot and uses pipe as input
|
||||||
|
|||||||
Reference in New Issue
Block a user