mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-04-11 22:40:01 +03:00
fix test
This commit is contained in:
parent
a2f4dd4227
commit
b247b0408b
@ -29,6 +29,12 @@ class TestZfsEncryption(unittest2.TestCase):
|
||||
except:
|
||||
self.skipTest("Encryption not supported on this ZFS version.")
|
||||
|
||||
def load_key(self, key, path):
|
||||
|
||||
shelltest("rm /tmp/zfstest.key 2>/dev/null;true")
|
||||
shelltest("echo {} > /tmp/zfstest.key".format(key))
|
||||
shelltest("zfs load-key {}".format(path))
|
||||
|
||||
def prepare_encrypted_dataset(self, key, path, unload_key=False):
|
||||
|
||||
# create encrypted source dataset
|
||||
@ -269,6 +275,8 @@ test_target1/test_source2/fs2/sub encryptionroot -
|
||||
|
||||
|
||||
|
||||
#NOTE: this leaves 2 weird sub-datasets that should'nt be there (its a zfs thing i think)
|
||||
|
||||
r = shelltest("zfs get -r -t all encryptionroot test_target1")
|
||||
self.assertEqual(r, """
|
||||
NAME PROPERTY VALUE SOURCE
|
||||
@ -282,8 +290,24 @@ test_target1/encryptedtarget/test_source1/fs1/encryptedsource@test-2010111100000
|
||||
test_target1/encryptedtarget/test_source1/fs1/encryptedsource@test-20101111000001 encryptionroot test_target1/encryptedtarget/test_source1/fs1/encryptedsource -
|
||||
test_target1/encryptedtarget/test_source1/fs1/sub encryptionroot test_target1/encryptedtarget -
|
||||
test_target1/encryptedtarget/test_source1/fs1/sub@test-20101111000000 encryptionroot test_target1/encryptedtarget -
|
||||
test_target1/encryptedtarget/test_source1/fs1/sub/sub encryptionroot - -
|
||||
test_target1/encryptedtarget/test_source1/fs1/sub/sub@test-20101111000001 encryptionroot - -
|
||||
test_target1/encryptedtarget/test_source2 encryptionroot test_target1/encryptedtarget -
|
||||
test_target1/encryptedtarget/test_source2/fs2 encryptionroot test_target1/encryptedtarget -
|
||||
test_target1/encryptedtarget/test_source2/fs2/sub encryptionroot test_target1/encryptedtarget -
|
||||
test_target1/encryptedtarget/test_source2/fs2/sub@test-20101111000000 encryptionroot test_target1/encryptedtarget -
|
||||
test_target1/encryptedtarget/test_source2/fs2/sub/sub encryptionroot - -
|
||||
test_target1/encryptedtarget/test_source2/fs2/sub/sub@test-20101111000001 encryptionroot - -
|
||||
""")
|
||||
|
||||
|
||||
|
||||
#reload key and resume correctly.
|
||||
self.load_key("22222222", "test_target1/encryptedtarget")
|
||||
|
||||
# resume
|
||||
with mocktime("20101111000001"):
|
||||
self.assertEqual(ZfsAutobackup(
|
||||
"test test_target1/encryptedtarget --verbose --no-progress --encrypt --exclude-received --allow-empty --no-snapshot --clear-mountpoint".split(
|
||||
" ")).run(),0)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user