assert 'Use the bluestore objectstore' in stdout
assert 'A physical device or logical' in stdout
- def test_excludes_filestore_bluestore_flags(self, capsys):
+ def test_excludes_filestore_bluestore_flags(self, capsys, device_info):
+ device_info()
with pytest.raises(SystemExit):
lvm.create.Create(argv=['--data', '/dev/sdfoo', '--filestore', '--bluestore']).main()
stdout, sterr = capsys.readouterr()
expected = 'Cannot use --filestore (filestore) with --bluestore (bluestore)'
assert expected in stdout
- def test_excludes_other_filestore_bluestore_flags(self, capsys):
+ def test_excludes_other_filestore_bluestore_flags(self, capsys, device_info):
+ device_info()
with pytest.raises(SystemExit):
lvm.create.Create(argv=[
'--bluestore', '--data', '/dev/sdfoo',
expected = 'Cannot use --bluestore (bluestore) with --journal (filestore)'
assert expected in stdout
- def test_excludes_block_and_journal_flags(self, capsys):
+ def test_excludes_block_and_journal_flags(self, capsys, device_info):
+ device_info()
with pytest.raises(SystemExit):
lvm.create.Create(argv=[
'--bluestore', '--data', '/dev/sdfoo', '--block.db', 'vg/ceph1',
assert 'Use the bluestore objectstore' in stdout
assert 'A physical device or logical' in stdout
- def test_excludes_filestore_bluestore_flags(self, capsys):
+ def test_excludes_filestore_bluestore_flags(self, capsys, device_info):
+ device_info()
with pytest.raises(SystemExit):
lvm.prepare.Prepare(argv=['--data', '/dev/sdfoo', '--filestore', '--bluestore']).main()
stdout, stderr = capsys.readouterr()
expected = 'Cannot use --filestore (filestore) with --bluestore (bluestore)'
assert expected in stdout
- def test_excludes_other_filestore_bluestore_flags(self, capsys):
+ def test_excludes_other_filestore_bluestore_flags(self, capsys, device_info):
+ device_info()
with pytest.raises(SystemExit):
lvm.prepare.Prepare(argv=[
'--bluestore', '--data', '/dev/sdfoo',
expected = 'Cannot use --bluestore (bluestore) with --journal (filestore)'
assert expected in stdout
- def test_excludes_block_and_journal_flags(self, capsys):
+ def test_excludes_block_and_journal_flags(self, capsys, device_info):
+ device_info()
with pytest.raises(SystemExit):
lvm.prepare.Prepare(argv=[
'--bluestore', '--data', '/dev/sdfoo', '--block.db', 'vg/ceph1',
expected = 'Cannot use --block.db (bluestore) with --journal (filestore)'
assert expected in stdout
- def test_journal_is_required_with_filestore(self, is_root, monkeypatch):
- monkeypatch.setattr('os.path.exists', lambda x: True)
+ def test_journal_is_required_with_filestore(self, is_root, monkeypatch, device_info):
+ monkeypatch.setattr("os.path.exists", lambda path: True)
+ device_info()
with pytest.raises(SystemExit) as error:
lvm.prepare.Prepare(argv=['--filestore', '--data', '/dev/sdfoo']).main()
expected = '--journal is required when using --filestore'
from ceph_volume.util import arg_validators
-invalid_lv_paths = [
- '', 'lv_name', '/lv_name', 'lv_name/',
- '/dev/lv_group/lv_name'
-]
-
-
-class TestLVPath(object):
-
- def setup(self):
- self.validator = arg_validators.LVPath()
-
- @pytest.mark.parametrize('path', invalid_lv_paths)
- def test_no_slash_is_an_error(self, path):
- with pytest.raises(argparse.ArgumentError):
- self.validator(path)
-
- def test_is_valid(self):
- path = 'vg/lv'
- assert self.validator(path) == path
-
- def test_abspath_is_valid(self):
- path = '/'
- assert self.validator(path) == path
-
-
class TestOSDPath(object):
def setup(self):
assert "foo" in disk.sys_api
def test_is_lv(self, device_info):
- data = {"lv_path": "vg/lv", "vg_name": "vg"}
+ data = {"lv_path": "vg/lv", "vg_name": "vg", "name": "lv"}
device_info(lv=data)
disk = device.Device("vg/lv")
assert disk.is_lv