From 0176c1965e6ed532b38dfee03af0e9e3a85149d6 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 2 Oct 2018 11:18:22 -0400 Subject: [PATCH] ceph-volume tests.util verify devices that don't exist don't break get_devices Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/tests/util/test_disk.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ceph-volume/ceph_volume/tests/util/test_disk.py b/src/ceph-volume/ceph_volume/tests/util/test_disk.py index 941cb60c3acca..fd3839307e86a 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_disk.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_disk.py @@ -197,6 +197,15 @@ class TestGetDevices(object): _mapper_path=str(tmpdir)) assert result == {} + def test_no_devices_are_found_errors(self, tmpdir): + block_path, dev_path, mapper_path = self.setup_paths(tmpdir) + os.makedirs(os.path.join(block_path, 'sda')) + result = disk.get_devices( + _sys_block_path=block_path, # has 1 device + _dev_path=str(tmpdir), # exists but no devices + _mapper_path='/does/not/exist/path') # does not exist + assert result == {} + def test_sda_block_is_found(self, tmpfile, tmpdir): block_path, dev_path, mapper_path = self.setup_paths(tmpdir) dev_sda_path = os.path.join(dev_path, 'sda') -- 2.39.5