summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Schoen <aschoen@redhat.com>2018-11-14 17:35:32 +0100
committerAndrew Schoen <aschoen@redhat.com>2018-11-14 17:36:30 +0100
commit0cb95ace88a731f7c30adf3f2286691fa3b2c49c (patch)
treec2d4e29f41948466385552b90656bcc70213bdf5 /src
parentceph-volume: return lvs as vg/lv from ValidDevice if as_string is True (diff)
downloadceph-0cb95ace88a731f7c30adf3f2286691fa3b2c49c.tar.xz
ceph-0cb95ace88a731f7c30adf3f2286691fa3b2c49c.zip
ceph-volume: update tests after removing the LVPath arg validator
Signed-off-by: Andrew Schoen <aschoen@redhat.com> Resolves: rm#27062
Diffstat (limited to 'src')
-rw-r--r--src/ceph-volume/ceph_volume/tests/devices/lvm/test_create.py9
-rw-r--r--src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py14
-rw-r--r--src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py25
-rw-r--r--src/ceph-volume/ceph_volume/tests/util/test_device.py2
4 files changed, 16 insertions, 34 deletions
diff --git a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_create.py b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_create.py
index a08564c2694..62790c9eb76 100644
--- a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_create.py
+++ b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_create.py
@@ -17,14 +17,16 @@ class TestCreate(object):
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',
@@ -34,7 +36,8 @@ class TestCreate(object):
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',
diff --git a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py
index 4f5aeea874c..c7963bb2ff1 100644
--- a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py
+++ b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py
@@ -62,14 +62,16 @@ class TestPrepare(object):
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',
@@ -79,7 +81,8 @@ class TestPrepare(object):
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',
@@ -89,8 +92,9 @@ class TestPrepare(object):
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'
diff --git a/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py b/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py
index 9f20edbf724..2167aeac146 100644
--- a/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py
+++ b/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py
@@ -4,31 +4,6 @@ from ceph_volume import exceptions
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):
diff --git a/src/ceph-volume/ceph_volume/tests/util/test_device.py b/src/ceph-volume/ceph_volume/tests/util/test_device.py
index 74e817c6a5d..e941370244d 100644
--- a/src/ceph-volume/ceph_volume/tests/util/test_device.py
+++ b/src/ceph-volume/ceph_volume/tests/util/test_device.py
@@ -13,7 +13,7 @@ class TestDevice(object):
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