working on proper encryption support
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from CmdPipe import CmdPipe
|
||||
from zfs_autobackup.CmdPipe import CmdPipe
|
||||
from basetest import *
|
||||
import time
|
||||
|
||||
@ -882,9 +882,31 @@ test_target1/test_source2/fs2/sub@test-20101111000003
|
||||
###########################
|
||||
# TODO:
|
||||
|
||||
def test_raw(self):
|
||||
def test_encrypted(self):
|
||||
|
||||
self.skipTest("todo: later when travis supports zfs 0.8")
|
||||
# create encrypted dataset
|
||||
shelltest("echo 12345678 > /tmp/zfstest.key")
|
||||
shelltest("zfs create -o keylocation=file:///tmp/zfstest.key -o keyformat=passphrase -o encryption=on test_source1/fs1/enc1")
|
||||
r=shelltest("dd if=/dev/zero of=/test_source1/fs1/enc1/data.txt bs=200000 count=1")
|
||||
|
||||
with patch('time.strftime', return_value="20101111000000"):
|
||||
self.assertFalse(ZfsAutobackup("test test_target1 --allow-empty --verbose --no-progress".split(" ")).run())
|
||||
# self.skipTest("todo: later when travis supports zfs 0.8")
|
||||
r = shelltest("zfs get encryption -H -o value test_target1/test_source1/fs1/enc1")
|
||||
self.assertNotIn("off",r)
|
||||
|
||||
def test_decrypted(self):
|
||||
|
||||
# create encrypted dataset
|
||||
shelltest("echo 12345678 > /tmp/zfstest.key")
|
||||
shelltest("zfs create -o keylocation=file:///tmp/zfstest.key -o keyformat=passphrase -o encryption=on test_source1/fs1/enc1")
|
||||
r=shelltest("dd if=/dev/zero of=/test_source1/fs1/enc1/data.txt bs=200000 count=1")
|
||||
|
||||
with patch('time.strftime', return_value="20101111000000"):
|
||||
self.assertFalse(ZfsAutobackup("test test_target1 --decrypt --allow-empty --no-progress".split(" ")).run())
|
||||
# self.skipTest("todo: later when travis supports zfs 0.8")
|
||||
r = shelltest("zfs get encryption -H -o value test_target1/test_source1/fs1/enc1")
|
||||
self.assertIn("off",r)
|
||||
|
||||
|
||||
def test_progress(self):
|
||||
@ -896,7 +918,7 @@ test_target1/test_source2/fs2/sub@test-20101111000003
|
||||
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, output_pipes=[])
|
||||
sp=d.send_pipe([], prev_snapshot=None, resume_token=None, show_progress=True, raw=False, output_pipes=[], send_properties=False)
|
||||
|
||||
|
||||
with OutputIO() as buf:
|
||||
|
||||
Reference in New Issue
Block a user