From: Alfredo Deza Date: Mon, 19 Feb 2018 21:31:04 +0000 (-0500) Subject: ceph-volume tests add exclusion checks in create X-Git-Tag: wip-pdonnell-testing-20180317.202121~253^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2f6248c94be9b57766b820b23826714897153a51;p=ceph-ci.git ceph-volume tests add exclusion checks in create Signed-off-by: Alfredo Deza --- 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 new file mode 100644 index 00000000000..a08564c2694 --- /dev/null +++ b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_create.py @@ -0,0 +1,45 @@ +import pytest +from ceph_volume.devices import lvm + + +class TestCreate(object): + + def test_main_spits_help_with_no_arguments(self, capsys): + lvm.create.Create([]).main() + stdout, stderr = capsys.readouterr() + assert 'Create an OSD by assigning an ID and FSID' in stdout + + def test_main_shows_full_help(self, capsys): + with pytest.raises(SystemExit): + lvm.create.Create(argv=['--help']).main() + stdout, stderr = capsys.readouterr() + assert 'Use the filestore objectstore' in stdout + assert 'Use the bluestore objectstore' in stdout + assert 'A physical device or logical' in stdout + + def test_excludes_filestore_bluestore_flags(self, capsys): + 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): + with pytest.raises(SystemExit): + lvm.create.Create(argv=[ + '--bluestore', '--data', '/dev/sdfoo', + '--journal', '/dev/sf14', + ]).main() + stdout, sterr = capsys.readouterr() + expected = 'Cannot use --bluestore (bluestore) with --journal (filestore)' + assert expected in stdout + + def test_excludes_block_and_journal_flags(self, capsys): + with pytest.raises(SystemExit): + lvm.create.Create(argv=[ + '--bluestore', '--data', '/dev/sdfoo', '--block.db', 'vg/ceph1', + '--journal', '/dev/sf14', + ]).main() + stdout, sterr = capsys.readouterr() + expected = 'Cannot use --block.db (bluestore) with --journal (filestore)' + assert expected in stdout