]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph_volume: fix unit tests
authorSébastien Han <seb@redhat.com>
Tue, 27 Nov 2018 17:38:37 +0000 (18:38 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 3 Dec 2018 13:39:43 +0000 (14:39 +0100)
Fix the container_binary to use by mocking the CEPH_CONTAINER_BINARY env
variable.

Signed-off-by: Sébastien Han <seb@redhat.com>
library/ceph_volume.py
library/test_ceph_volume.py

index 75a293285cd9fead08ce3f9c246ccaedf725fb81..f47aa98f86866546e7b60a207405d0e68cf75e17 100644 (file)
@@ -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)
index 401c3e925d340b2036c85e5460225c33df08a55e..bb25727de1d9f1469db3529918d442e4e5d97cdb 100644 (file)
@@ -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):