3 from ceph_volume import main
6 class TestVolume(object):
8 def test_main_spits_help_with_no_arguments(self, capsys):
10 stdout, stderr = capsys.readouterr()
11 assert 'Log Path' in stdout
13 def test_warn_about_using_help_for_full_options(self, capsys):
15 stdout, stderr = capsys.readouterr()
16 assert 'See "ceph-volume --help" for full list' in stdout
18 def test_environ_vars_show_up(self, capsys):
19 os.environ['CEPH_CONF'] = '/opt/ceph.conf'
21 stdout, stderr = capsys.readouterr()
22 assert 'CEPH_CONF' in stdout
23 assert '/opt/ceph.conf' in stdout
25 def test_flags_are_parsed_with_help(self, capsys):
26 with pytest.raises(SystemExit):
27 main.Volume(argv=['ceph-volume', '--help'])
28 stdout, stderr = capsys.readouterr()
29 assert '--cluster' in stdout
30 assert '--log-path' in stdout
32 def test_log_ignoring_missing_ceph_conf(self, caplog):
33 with pytest.raises(SystemExit) as error:
34 main.Volume(argv=['ceph-volume', '--cluster', 'barnacle', 'lvm', '--help'])
35 # make sure we aren't causing an actual error
36 assert error.value.code == 0
37 log = caplog.records[0]
38 assert log.message == 'ignoring inability to load ceph.conf'
39 assert log.levelname == 'ERROR'