mirror of https://github.com/ceph/ceph-ansible.git
testinfra: add support for podman
Since we are now testing on docker and podman our functionnal tests must reflect that. So now, if we detect the podman binary we will use it, otherwise we default to docker. Signed-off-by: Sébastien Han <seb@redhat.com>pull/3367/head
parent
f5c2ca3710
commit
dcc765d7c7
|
@ -22,7 +22,11 @@ class TestMDSs(object):
|
|||
def test_mds_is_up(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
if node['docker']:
|
||||
docker_exec_cmd = 'docker exec ceph-mds-{hostname}'.format(hostname=hostname)
|
||||
container_binary = 'docker'
|
||||
if host.exists('podman') and host.ansible("setup")["ansible_facts"]["ansible_distribution"] == 'Fedora': # noqa E501
|
||||
container_binary = 'podman'
|
||||
docker_exec_cmd = '{container_binary} exec ceph-mds-{hostname}'.format(
|
||||
hostname=hostname, container_binary=container_binary)
|
||||
else:
|
||||
docker_exec_cmd = ''
|
||||
|
||||
|
|
|
@ -20,10 +20,14 @@ class TestMGRs(object):
|
|||
assert host.service(service_name).is_enabled
|
||||
|
||||
def test_mgr_is_up(self, node, host):
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
cluster=node["cluster_name"]
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node["cluster_name"]
|
||||
if node['docker']:
|
||||
docker_exec_cmd = 'docker exec ceph-mgr-{hostname}'.format(hostname=hostname)
|
||||
container_binary = 'docker'
|
||||
if host.exists('podman') and host.ansible("setup")["ansible_facts"]["ansible_distribution"] == 'Fedora': # noqa E501
|
||||
container_binary = 'podman'
|
||||
docker_exec_cmd = '{container_binary} exec ceph-mgr-{hostname}'.format(
|
||||
hostname=hostname, container_binary=container_binary)
|
||||
else:
|
||||
docker_exec_cmd = ''
|
||||
cmd = "sudo {docker_exec_cmd} ceph --name mgr.{hostname} --keyring /var/lib/ceph/mgr/{cluster}-{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
|
|
|
@ -27,7 +27,11 @@ class TestNFSs(object):
|
|||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node['cluster_name']
|
||||
if node['docker']:
|
||||
docker_exec_cmd = 'docker exec ceph-nfs-{hostname}'.format(hostname=hostname)
|
||||
container_binary = 'docker'
|
||||
if host.exists('podman') and host.ansible("setup")["ansible_facts"]["ansible_distribution"] == 'Fedora': # noqa E501
|
||||
container_binary = 'podman'
|
||||
docker_exec_cmd = '{container_binary} exec ceph-nfs-{hostname}'.format(
|
||||
hostname=hostname, container_binary=container_binary)
|
||||
else:
|
||||
docker_exec_cmd = ''
|
||||
cmd = "sudo {docker_exec_cmd} ceph --name client.rgw.{hostname} --keyring /var/lib/ceph/radosgw/{cluster}-rgw.{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
|
|
|
@ -71,11 +71,15 @@ class TestOSDs(object):
|
|||
|
||||
@pytest.mark.docker
|
||||
def test_all_docker_osds_are_up_and_in(self, node, host):
|
||||
osd_id = host.check_output(
|
||||
"docker ps -q --filter='name=ceph-osd' | head -1")
|
||||
cmd = "sudo docker exec {osd_id} ceph --cluster={cluster} --connect-timeout 5 --keyring /var/lib/ceph/bootstrap-osd/{cluster}.keyring -n client.bootstrap-osd osd tree -f json".format(
|
||||
container_binary = 'docker'
|
||||
if host.exists('podman') and host.ansible("setup")["ansible_facts"]["ansible_distribution"] == 'Fedora': # noqa E501
|
||||
container_binary = 'podman'
|
||||
osd_id = host.check_output(os.path.join(
|
||||
container_binary + " ps -q --filter='name=ceph-osd' | head -1"))
|
||||
cmd = "sudo {container_binary} exec {osd_id} ceph --cluster={cluster} --connect-timeout 5 --keyring /var/lib/ceph/bootstrap-osd/{cluster}.keyring -n client.bootstrap-osd osd tree -f json".format(
|
||||
osd_id=osd_id,
|
||||
cluster=node["cluster_name"]
|
||||
cluster=node["cluster_name"],
|
||||
container_binary=container_binary
|
||||
)
|
||||
output = json.loads(host.check_output(cmd))
|
||||
assert node["num_osds"] == self._get_nb_up_osds_from_ids(node, output)
|
||||
|
|
|
@ -28,11 +28,15 @@ class TestRbdMirrors(object):
|
|||
assert host.service(service_name).is_enabled
|
||||
|
||||
def test_rbd_mirror_is_up(self, node, host):
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
cluster=node["cluster_name"]
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node["cluster_name"]
|
||||
daemons = []
|
||||
if node['docker']:
|
||||
docker_exec_cmd = 'docker exec ceph-rbd-mirror-{hostname}'.format(hostname=hostname)
|
||||
container_binary = 'docker'
|
||||
if host.exists('podman') and host.ansible("setup")["ansible_facts"]["ansible_distribution"] == 'Fedora': # noqa E501
|
||||
container_binary = 'podman'
|
||||
docker_exec_cmd = '{container_binary} exec ceph-rbd-mirror-{hostname}'.format(
|
||||
hostname=hostname, container_binary=container_binary)
|
||||
else:
|
||||
docker_exec_cmd = ''
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
|
|
|
@ -23,10 +23,14 @@ class TestRGWs(object):
|
|||
assert host.service(service_name).is_enabled
|
||||
|
||||
def test_rgw_is_up(self, node, host):
|
||||
hostname=node["vars"]["inventory_hostname"]
|
||||
cluster=node["cluster_name"]
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node["cluster_name"]
|
||||
if node['docker']:
|
||||
docker_exec_cmd = 'docker exec ceph-rgw-{hostname}'.format(hostname=hostname)
|
||||
container_binary = 'docker'
|
||||
if host.exists('podman') and host.ansible("setup")["ansible_facts"]["ansible_distribution"] == 'Fedora': # noqa E501
|
||||
container_binary = 'podman'
|
||||
docker_exec_cmd = '{container_binary} exec ceph-rgw-{hostname}'.format(
|
||||
hostname=hostname, container_binary=container_binary)
|
||||
else:
|
||||
docker_exec_cmd = ''
|
||||
cmd = "sudo {docker_exec_cmd} ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
|
||||
|
|
|
@ -37,9 +37,13 @@ class TestRGWs(object):
|
|||
def test_docker_rgw_tuning_pools_are_set(self, node, host):
|
||||
hostname = node["vars"]["inventory_hostname"]
|
||||
cluster = node['cluster_name']
|
||||
cmd = "sudo docker exec ceph-rgw-{hostname} ceph --cluster={cluster} -n client.rgw.{hostname} --connect-timeout 5 --keyring /var/lib/ceph/radosgw/{cluster}-rgw.{hostname}/keyring osd dump".format(
|
||||
container_binary = 'docker'
|
||||
if host.exists('podman') and host.ansible("setup")["ansible_facts"]["ansible_distribution"] == 'Fedora': # noqa E501
|
||||
container_binary = 'podman'
|
||||
cmd = "sudo {container_binary} exec ceph-rgw-{hostname} ceph --cluster={cluster} -n client.rgw.{hostname} --connect-timeout 5 --keyring /var/lib/ceph/radosgw/{cluster}-rgw.{hostname}/keyring osd dump".format(
|
||||
hostname=hostname,
|
||||
cluster=cluster
|
||||
cluster=cluster,
|
||||
container_binary=container_binary
|
||||
)
|
||||
output = host.check_output(cmd)
|
||||
pools = node["vars"].get("rgw_create_pools")
|
||||
|
|
Loading…
Reference in New Issue