From 8a0e7fad57e41e10d51e0e167b671668ee1aa286 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 19 Oct 2017 10:35:51 -0500 Subject: [PATCH] ceph-volume: adds tests for api.lvm.remove_lv Signed-off-by: Andrew Schoen (cherry picked from commit 937b57438147681c2c6e32c6db38d8bea68d4731) --- .../ceph_volume/tests/api/test_lvm.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 e7e9015ce8171..3639f01e5de59 100644 --- a/src/ceph-volume/ceph_volume/tests/api/test_lvm.py +++ b/src/ceph-volume/ceph_volume/tests/api/test_lvm.py @@ -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): -- 2.39.5