From: Alfredo Deza Date: Fri, 18 Jan 2019 17:51:04 +0000 (-0500) Subject: ceph-volume tests verify behavior of create_dmcrypt_key in python 3 X-Git-Tag: v13.2.5~131^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26113%2Fhead;p=ceph.git ceph-volume tests verify behavior of create_dmcrypt_key in python 3 Signed-off-by: Alfredo Deza (cherry picked from commit 69613cc5a8b2e111e24b75ad5b69f924c89fd75b) --- diff --git a/src/ceph-volume/ceph_volume/tests/util/test_encryption.py b/src/ceph-volume/ceph_volume/tests/util/test_encryption.py index 8cca42689b4..e1420b440d3 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_encryption.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_encryption.py @@ -33,3 +33,21 @@ class TestDmcryptClose(object): file_name = '/path/does/not/exist' encryption.dmcrypt_close(file_name) assert fake_run.calls == [] + + +class TestDmcryptKey(object): + + def test_dmcrypt_with_default_size(self, conf_ceph_stub): + conf_ceph_stub('[global]\nfsid=asdf-lkjh') + result = encryption.create_dmcrypt_key() + assert len(result) == 172 + + def test_dmcrypt_with_custom_size(self, conf_ceph_stub): + conf_ceph_stub(''' + [global] + fsid=asdf + [osd] + osd_dmcrypt_size=8 + ''') + result = encryption.create_dmcrypt_key() + assert len(result) == 172