From a42ba03d71364d27f15719ad5a1ac300373abad0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Tue, 27 Nov 2018 18:38:37 +0100 Subject: [PATCH] ceph_volume: fix unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix the container_binary to use by mocking the CEPH_CONTAINER_BINARY env variable. Signed-off-by: Sébastien Han --- library/ceph_volume.py | 2 +- library/test_ceph_volume.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 75a293285..f47aa98f8 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -273,7 +273,7 @@ def batch(module, container_image): journal_size = module.params.get('journal_size', None) block_db_size = module.params.get('block_db_size', None) dmcrypt = module.params.get('dmcrypt', None) - osds_per_device = module.params.get('osds_per_device', None) + osds_per_device = module.params.get('osds_per_device', 1) if not osds_per_device: fatal('osds_per_device must be provided if action is "batch"', module) diff --git a/library/test_ceph_volume.py b/library/test_ceph_volume.py index 401c3e925..bb25727de 100644 --- a/library/test_ceph_volume.py +++ b/library/test_ceph_volume.py @@ -1,7 +1,10 @@ from . import ceph_volume from ansible.compat.tests.mock import MagicMock +import mock +import os +@mock.patch.dict(os.environ, {'CEPH_CONTAINER_BINARY': 'docker'}) class TestCephVolumeModule(object): def test_data_no_vg(self): -- 2.47.3