]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests ensure Volume.as_dict gets populated correctly
authorAlfredo Deza <adeza@redhat.com>
Mon, 2 Oct 2017 18:40:41 +0000 (14:40 -0400)
committerAlfredo Deza <adeza@redhat.com>
Tue, 3 Oct 2017 13:00:13 +0000 (09:00 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
src/ceph-volume/ceph_volume/tests/devices/lvm/test_api.py

index d6aa549040d76e3fccf0677eb517b5ea7e79fa93..ce99efcb0c73b98455b649e12b16bc6b0d57157b 100644 (file)
@@ -189,6 +189,20 @@ class TestVolumes(object):
         with pytest.raises(exceptions.MultipleLVsError):
             volumes.get(lv_name='foo')
 
+    def test_as_dict_infers_type_from_tags(self, volumes):
+        lv_tags = "ceph.type=data,ceph.fsid=000-aaa"
+        osd = api.Volume(lv_name='volume1', lv_path='/dev/vg/lv', lv_tags=lv_tags)
+        volumes.append(osd)
+        result = volumes.get(lv_tags={'ceph.type': 'data'}).as_dict()
+        assert result['type'] == 'data'
+
+    def test_as_dict_populates_path_from_lv_api(self, volumes):
+        lv_tags = "ceph.type=data,ceph.fsid=000-aaa"
+        osd = api.Volume(lv_name='volume1', lv_path='/dev/vg/lv', lv_tags=lv_tags)
+        volumes.append(osd)
+        result = volumes.get(lv_tags={'ceph.type': 'data'}).as_dict()
+        assert result['path'] == '/dev/vg/lv'
+
     def test_find_the_correct_one(self, volumes):
         volume1 = api.Volume(lv_name='volume1', lv_path='/dev/vg/lv', lv_tags='')
         volume2 = api.Volume(lv_name='volume2', lv_path='/dev/vg/lv', lv_tags='')