]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: tests for lvm zap --destroy
authorAndrew Schoen <aschoen@redhat.com>
Thu, 18 Jan 2018 18:04:38 +0000 (12:04 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 18 Jan 2018 18:08:58 +0000 (12:08 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/tests/api/test_lvm.py
src/ceph-volume/ceph_volume/tests/devices/test_zap.py

index 1a2dff95989453a29fd104d8832e2d26315a5360..a56582b3574e91b48bac539038fe845a146445ca 100644 (file)
@@ -131,13 +131,13 @@ class TestGetPV(object):
         assert api.get_pv() is None
 
     def test_single_pv_is_not_matched(self, pvolumes, monkeypatch):
-        FooPVolume = api.PVolume(pv_name='/dev/sda', pv_uuid="0000", pv_tags={})
+        FooPVolume = api.PVolume(pv_name='/dev/sda', pv_uuid="0000", pv_tags={}, vg_name="vg")
         pvolumes.append(FooPVolume)
         monkeypatch.setattr(api, 'PVolumes', lambda: pvolumes)
         assert api.get_pv(pv_uuid='foo') is None
 
     def test_single_pv_is_matched(self, pvolumes, monkeypatch):
-        FooPVolume = api.PVolume(pv_name='/dev/sda', pv_uuid="0000", pv_tags={})
+        FooPVolume = api.PVolume(vg_name="vg", pv_name='/dev/sda', pv_uuid="0000", pv_tags={})
         pvolumes.append(FooPVolume)
         monkeypatch.setattr(api, 'PVolumes', lambda: pvolumes)
         assert api.get_pv(pv_uuid='0000') == FooPVolume
@@ -145,11 +145,20 @@ class TestGetPV(object):
     def test_single_pv_is_matched_by_uuid(self, pvolumes, monkeypatch):
         FooPVolume = api.PVolume(
             pv_name='/dev/vg/foo',
-            pv_uuid='1111', pv_tags="ceph.type=data")
+            pv_uuid='1111', pv_tags="ceph.type=data", vg_name="vg")
         pvolumes.append(FooPVolume)
         monkeypatch.setattr(api, 'PVolumes', lambda: pvolumes)
         assert api.get_pv(pv_uuid='1111') == FooPVolume
 
+    def test_vg_name_is_set(self, pvolumes, monkeypatch):
+        FooPVolume = api.PVolume(
+            pv_name='/dev/vg/foo',
+            pv_uuid='1111', pv_tags="ceph.type=data", vg_name="vg")
+        pvolumes.append(FooPVolume)
+        monkeypatch.setattr(api, 'PVolumes', lambda: pvolumes)
+        pv = api.get_pv(pv_name="/dev/vg/foo")
+        assert pv.vg_name == "vg"
+
 
 class TestPVolumes(object):
 
@@ -157,7 +166,7 @@ class TestPVolumes(object):
         pv_tags = "ceph.type=journal,ceph.osd_id=1,ceph.fsid=000-aaa"
         FooPVolume = api.PVolume(
             pv_name='/dev/vg/foo',
-            pv_uuid='1111', pv_tags=pv_tags)
+            pv_uuid='1111', pv_tags=pv_tags, vg_name='vg')
         pvolumes.append(FooPVolume)
         pvolumes.filter(pv_tags={'ceph.type': 'journal', 'ceph.osd_id': '2'})
         assert pvolumes == []
@@ -166,7 +175,7 @@ class TestPVolumes(object):
         pv_tags = "ceph.type=journal,ceph.osd_id=1"
         FooPVolume = api.PVolume(
             pv_name='/dev/vg/foo',
-            pv_uuid='1111', pv_tags=pv_tags)
+            pv_uuid='1111', pv_tags=pv_tags, vg_name="vg")
         pvolumes.append(FooPVolume)
         pvolumes.filter(pv_tags={'ceph.type': 'journal', 'ceph.osd_id': '1'})
         assert pvolumes == [FooPVolume]
index bc26e33da5c338e4f514633d638bde3609448eff..5e267fca77e5978b4ebe7760ec61c34d40dbfb08 100644 (file)
@@ -7,7 +7,7 @@ class TestZap(object):
     def test_main_spits_help_with_no_arguments(self, capsys):
         lvm.zap.Zap([]).main()
         stdout, stderr = capsys.readouterr()
-        assert 'Zaps the given logical volume or partition' in stdout
+        assert 'Zaps the given logical volume, raw device or partition' in stdout
 
     def test_main_shows_full_help(self, capsys):
         with pytest.raises(SystemExit):