From: Jan Fajerski Date: Wed, 12 Feb 2020 15:49:30 +0000 (+0100) Subject: ceph-volume: add is_ceph_device unit tests X-Git-Tag: v15.1.1~447^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=60d80636e4708761287197c534347f82e307c603;p=ceph-ci.git ceph-volume: add is_ceph_device unit tests Signed-off-by: Jan Fajerski --- diff --git a/src/ceph-volume/ceph_volume/tests/api/test_lvm.py b/src/ceph-volume/ceph_volume/tests/api/test_lvm.py index 43125471bac..c0f8e3f5391 100644 --- a/src/ceph-volume/ceph_volume/tests/api/test_lvm.py +++ b/src/ceph-volume/ceph_volume/tests/api/test_lvm.py @@ -213,6 +213,24 @@ class TestGetVG(object): assert api.get_vg(vg_name='foo') == FooVG +class TestVolume(object): + + def test_is_ceph_device(self): + lv_tags = "ceph.type=data,ceph.osd_id=0" + osd = api.Volume(lv_name='osd/volume', lv_tags=lv_tags) + assert api.is_ceph_device(osd) + + @pytest.mark.parametrize('dev',[ + '/dev/sdb', + api.VolumeGroup(vg_name='foo'), + api.Volume(lv_name='vg/no_osd', lv_tags=''), + api.Volume(lv_name='vg/no_osd', lv_tags='ceph.osd_id=null'), + None, + ]) + def test_is_not_ceph_device(self, dev): + assert not api.is_ceph_device(dev) + + class TestVolumes(object): def test_volume_get_has_no_volumes(self, volumes):