From: Alfredo Deza Date: Tue, 11 Sep 2018 20:53:54 +0000 (-0400) Subject: ceph-volume lvm.tests conftest fixtures for custom vgs X-Git-Tag: v14.0.1~305^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9f14db432317c15b29b187d1e1a4bd3a729a7043;p=ceph.git ceph-volume lvm.tests conftest fixtures for custom vgs Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/tests/conftest.py b/src/ceph-volume/ceph_volume/tests/conftest.py index 65279dc9bdf7..5222b45e76d6 100644 --- a/src/ceph-volume/ceph_volume/tests/conftest.py +++ b/src/ceph-volume/ceph_volume/tests/conftest.py @@ -52,6 +52,24 @@ def fake_call(monkeypatch): return fake_call +@pytest.fixture +def fakedevice(factory): + def apply(**kw): + params = dict( + path='/dev/sda', + abspath='/dev/sda', + lv_api=None, + pvs_api=[], + disk_api={}, + sys_api={}, + exists=True, + is_lvm_member=True, + ) + params.update(dict(kw)) + return factory(**params) + return apply + + @pytest.fixture def stub_call(monkeypatch): """ @@ -117,6 +135,13 @@ def volume_groups(monkeypatch): return vgs +@pytest.fixture +def stub_vgs(monkeypatch, volume_groups): + def apply(vgs): + monkeypatch.setattr(lvm_api, 'get_api_vgs', lambda: vgs) + return apply + + @pytest.fixture def pvolumes(monkeypatch): monkeypatch.setattr('ceph_volume.process.call', lambda x: ('', '', 0))