2017-02-22 22:21:23 +08:00
|
|
|
import pytest
|
2018-06-20 00:08:10 +08:00
|
|
|
import re
|
2017-05-05 05:36:36 +08:00
|
|
|
|
2018-11-19 18:09:30 +08:00
|
|
|
|
2016-10-28 03:29:12 +08:00
|
|
|
class TestInstall(object):
|
|
|
|
|
2019-04-19 05:08:13 +08:00
|
|
|
def test_ceph_dir_exists_and_is_directory(self, host, node):
|
|
|
|
f = host.file('/etc/ceph')
|
|
|
|
assert f.exists
|
|
|
|
assert f.is_directory
|
2016-12-03 22:10:54 +08:00
|
|
|
|
2019-04-19 05:08:13 +08:00
|
|
|
def test_ceph_conf_exists_and_is_file(self, host, node, setup):
|
|
|
|
f = host.file(setup["conf_path"])
|
|
|
|
assert f.exists
|
|
|
|
assert f.is_file
|
2016-10-28 03:29:12 +08:00
|
|
|
|
2017-02-22 22:21:23 +08:00
|
|
|
@pytest.mark.no_docker
|
2017-08-22 03:41:58 +08:00
|
|
|
def test_ceph_command_exists(self, host, node):
|
|
|
|
assert host.exists("ceph")
|
2016-12-06 02:06:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
class TestCephConf(object):
|
|
|
|
|
2019-02-18 21:59:18 +08:00
|
|
|
def test_mon_host_line_has_correct_value(self, node, host, setup):
|
|
|
|
mon_host_line = host.check_output("grep 'mon host = ' /etc/ceph/{cluster}.conf".format(cluster=setup['cluster_name'])) # noqa E501
|
2018-11-19 18:09:30 +08:00
|
|
|
result = True
|
2019-02-18 21:59:18 +08:00
|
|
|
for x in range(0, setup["num_mons"]):
|
2019-04-19 05:08:13 +08:00
|
|
|
pattern = re.compile(("v2:{subnet}.1{x}:3300,v1:{subnet}.1{x}:6789".format(subnet=setup["subnet"], x=x))) # noqa E501
|
2018-11-19 18:09:30 +08:00
|
|
|
if pattern.search(mon_host_line) is None:
|
|
|
|
result = False
|
2018-06-20 00:08:10 +08:00
|
|
|
assert result
|