]>
Commit | Line | Data |
---|---|---|
3a9019d9 FG |
1 | import pytest |
2 | from ceph_volume.devices import lvm | |
3 | ||
4 | ||
5 | class TestCreate(object): | |
6 | ||
7 | def test_main_spits_help_with_no_arguments(self, capsys): | |
8 | lvm.create.Create([]).main() | |
9 | stdout, stderr = capsys.readouterr() | |
10 | assert 'Create an OSD by assigning an ID and FSID' in stdout | |
11 | ||
12 | def test_main_shows_full_help(self, capsys): | |
13 | with pytest.raises(SystemExit): | |
14 | lvm.create.Create(argv=['--help']).main() | |
15 | stdout, stderr = capsys.readouterr() | |
16 | assert 'Use the filestore objectstore' in stdout | |
17 | assert 'Use the bluestore objectstore' in stdout | |
18 | assert 'A physical device or logical' in stdout | |
19 | ||
91327a77 AA |
20 | def test_excludes_filestore_bluestore_flags(self, capsys, device_info): |
21 | device_info() | |
3a9019d9 FG |
22 | with pytest.raises(SystemExit): |
23 | lvm.create.Create(argv=['--data', '/dev/sdfoo', '--filestore', '--bluestore']).main() | |
494da23a | 24 | stdout, stderr = capsys.readouterr() |
3a9019d9 | 25 | expected = 'Cannot use --filestore (filestore) with --bluestore (bluestore)' |
494da23a | 26 | assert expected in stderr |
3a9019d9 | 27 | |
91327a77 AA |
28 | def test_excludes_other_filestore_bluestore_flags(self, capsys, device_info): |
29 | device_info() | |
3a9019d9 FG |
30 | with pytest.raises(SystemExit): |
31 | lvm.create.Create(argv=[ | |
32 | '--bluestore', '--data', '/dev/sdfoo', | |
33 | '--journal', '/dev/sf14', | |
34 | ]).main() | |
494da23a | 35 | stdout, stderr = capsys.readouterr() |
3a9019d9 | 36 | expected = 'Cannot use --bluestore (bluestore) with --journal (filestore)' |
494da23a | 37 | assert expected in stderr |
3a9019d9 | 38 | |
91327a77 AA |
39 | def test_excludes_block_and_journal_flags(self, capsys, device_info): |
40 | device_info() | |
3a9019d9 FG |
41 | with pytest.raises(SystemExit): |
42 | lvm.create.Create(argv=[ | |
43 | '--bluestore', '--data', '/dev/sdfoo', '--block.db', 'vg/ceph1', | |
44 | '--journal', '/dev/sf14', | |
45 | ]).main() | |
494da23a | 46 | stdout, stderr = capsys.readouterr() |
3a9019d9 | 47 | expected = 'Cannot use --block.db (bluestore) with --journal (filestore)' |
494da23a | 48 | assert expected in stderr |