]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume/tests: fix test_path_is_valid()
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 27 Jul 2022 12:28:10 +0000 (14:28 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 28 Jul 2022 18:14:06 +0000 (20:14 +0200)
When ceph-volume tests are run from a host where there's no `/dev/sda`
device, this test fails.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py

index 7e0abd1c3c77b46d89502fa1c70095600340170c..45c4ed50ec3700571216c5d5d7395c6085c309ab 100644 (file)
@@ -78,13 +78,14 @@ class TestExcludeGroupOptions(object):
 
 class TestValidDevice(object):
 
-    def setup(self):
+    def setup(self, fake_filesystem):
         self.validator = arg_validators.ValidDevice()
 
     @patch('ceph_volume.util.arg_validators.disk.has_bluestore_label', return_value=False)
     def test_path_is_valid(self, m_has_bs_label,
                            fake_call, patch_bluestore_label,
-                           device_info):
+                           device_info, monkeypatch):
+        monkeypatch.setattr('ceph_volume.util.device.Device.exists', lambda: True)
         lsblk = {"TYPE": "disk", "NAME": "sda"}
         device_info(lsblk=lsblk)
         result = self.validator('/dev/sda')