]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: adds tests for api.lvm.remove_lv
authorAndrew Schoen <aschoen@redhat.com>
Thu, 19 Oct 2017 15:35:51 +0000 (10:35 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 30 Oct 2017 15:12:15 +0000 (10:12 -0500)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit 937b57438147681c2c6e32c6db38d8bea68d4731)

src/ceph-volume/ceph_volume/tests/api/test_lvm.py

index e7e9015ce817185f5bc55a4f31c2d4f37c8a49ce..3639f01e5de597c4628465164b6ac05413f77ec5 100644 (file)
@@ -353,6 +353,22 @@ class TestGetLVFromArgument(object):
         assert api.get_lv_from_argument('/path/to/lv') == self.foo_volume
 
 
+class TestRemoveLV(object):
+
+    def test_removes_lv(self, monkeypatch):
+        def mock_call(cmd, **kw):
+            return ('', '', 0)
+        monkeypatch.setattr(process, 'call', mock_call)
+        assert api.remove_lv("vg/lv")
+
+    def test_fails_to_remove_lv(self, monkeypatch):
+        def mock_call(cmd, **kw):
+            return ('', '', 1)
+        monkeypatch.setattr(process, 'call', mock_call)
+        with pytest.raises(RuntimeError):
+            api.remove_lv("vg/lv")
+
+
 class TestCreateLV(object):
 
     def setup(self):