Merge pull request #31197 from jan--f/c-v-fix-lvm-mokeypatch

ceph-volume: mokeypatch calls to lvm related binaries
This commit is contained in:
Jan Fajerski 2019-10-29 15:27:02 +01:00 committed by GitHub
commit 6f8d366039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -928,6 +928,7 @@ class TestSplitNameParser(object):
class TestIsLV(object):
def test_is_not_an_lv(self, monkeypatch):
monkeypatch.setattr(api.process, 'call', lambda x, **kw: ('', '', 0))
monkeypatch.setattr(api, 'dmsetup_splitname', lambda x, **kw: {})
assert api.is_lv('/dev/sda1', lvs=[]) is False

View File

@ -1,5 +1,6 @@
import pytest
from ceph_volume.devices.lvm.strategies import bluestore
from ceph_volume.api import lvm
class TestSingleType(object):
@ -51,7 +52,7 @@ class TestSingleType(object):
class TestMixedType(object):
def test_filter_all_data_devs(self, fakedevice, factory):
def test_filter_all_data_devs(self, fakedevice, factory, monkeypatch):
# in this scenario the user passed a already used device to be used for
# data and an unused device to be used as db device.
db_dev = fakedevice(used_by_ceph=False, is_lvm_member=False, rotational=False, sys_api=dict(size=6073740000))
@ -59,6 +60,7 @@ class TestMixedType(object):
args = factory(filtered_devices=[data_dev], osds_per_device=1,
block_db_size=None, block_wal_size=None,
osd_ids=[])
monkeypatch.setattr(lvm, 'VolumeGroup', lambda x, **kw: [])
bluestore.MixedType(args, [], [db_dev], [])