Merge pull request #2028 from ceph/fix_testinfra

tests: rbd/rgw adapt testinfra for jewel
pull/2040/head
Sébastien Han 2017-10-12 16:19:33 +02:00 committed by GitHub
commit c6210fa85e
4 changed files with 51 additions and 2 deletions

View File

@ -21,6 +21,12 @@ def node(host, request):
docker = ansible_vars.get("docker") docker = ansible_vars.get("docker")
osd_auto_discovery = ansible_vars.get("osd_auto_discovery") osd_auto_discovery = ansible_vars.get("osd_auto_discovery")
lvm_scenario = ansible_vars.get("osd_scenario") == 'lvm' lvm_scenario = ansible_vars.get("osd_scenario") == 'lvm'
ceph_release_num = {
'jewel': 10,
'kraken': 11,
'luminous': 12,
'mimic': 13
}
if not request.node.get_marker(node_type) and not request.node.get_marker('all'): if not request.node.get_marker(node_type) and not request.node.get_marker('all'):
pytest.skip("Not a valid test for node type: %s" % node_type) pytest.skip("Not a valid test for node type: %s" % node_type)
@ -42,6 +48,12 @@ def node(host, request):
if node_type == "nfss" and ceph_stable_release == "jewel": if node_type == "nfss" and ceph_stable_release == "jewel":
pytest.skip("nfs nodes can not be tested with ceph release jewel") pytest.skip("nfs nodes can not be tested with ceph release jewel")
if request.node.get_marker("from_luminous") and ceph_release_num[ceph_stable_release] < ceph_release_num['luminous']:
pytest.skip("This test is only valid for releases starting from Luminous and above")
if request.node.get_marker("before_luminous") and ceph_release_num[ceph_stable_release] >= ceph_release_num['luminous']:
pytest.skip("This test is only valid for release before Luminous")
journal_collocation_test = ansible_vars.get("osd_scenario") == "collocated" journal_collocation_test = ansible_vars.get("osd_scenario") == "collocated"
if request.node.get_marker("journal_collocation") and not journal_collocation_test: if request.node.get_marker("journal_collocation") and not journal_collocation_test:
pytest.skip("Scenario is not using journal collocation") pytest.skip("Scenario is not using journal collocation")

View File

@ -0,0 +1 @@
../cluster/ceph-override.json

View File

@ -1,5 +1,6 @@
import pytest import pytest
import json import json
import os
class TestRbdMirrors(object): class TestRbdMirrors(object):
@ -7,19 +8,51 @@ class TestRbdMirrors(object):
def test_rbd_mirror_is_installed(self, node, host): def test_rbd_mirror_is_installed(self, node, host):
assert host.package("rbd-mirror").is_installed assert host.package("rbd-mirror").is_installed
def test_rbd_mirror_service_is_running(self, node, host): @pytest.mark.no_docker
@pytest.mark.before_luminous
def test_rbd_mirror_service_is_running_before_luminous(self, node, host):
service_name = "ceph-rbd-mirror@admin"
assert host.service(service_name).is_running
@pytest.mark.docker
@pytest.mark.before_luminous
def test_rbd_mirror_service_is_running_docker_before_luminous(self, node, host):
service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format( service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format(
hostname=node["vars"]["inventory_hostname"] hostname=node["vars"]["inventory_hostname"]
) )
assert host.service(service_name).is_running assert host.service(service_name).is_running
def test_rbd_mirror_service_is_enabled(self, node, host): @pytest.mark.docker
@pytest.mark.from_luminous
def test_rbd_mirror_service_is_running_docker_from_luminous(self, node, host):
service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format(
hostname=node["vars"]["inventory_hostname"]
)
assert host.service(service_name).is_running
@pytest.mark.no_docker
@pytest.mark.before_luminous
def test_rbd_mirror_service_is_enabled_before_luminous(self, node, host):
service_name = "ceph-rbd-mirror@admin"
assert host.service(service_name).is_enabled
@pytest.mark.docker
@pytest.mark.before_luminous
def test_rbd_mirror_service_is_enabled_docker_before_luminous(self, node, host):
service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format(
hostname=node["vars"]["inventory_hostname"]
)
assert host.service(service_name).is_enabled
@pytest.mark.from_luminous
def test_rbd_mirror_service_is_enabled_from_luminous(self, node, host):
service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format( service_name = "ceph-rbd-mirror@rbd-mirror.{hostname}".format(
hostname=node["vars"]["inventory_hostname"] hostname=node["vars"]["inventory_hostname"]
) )
assert host.service(service_name).is_enabled assert host.service(service_name).is_enabled
@pytest.mark.no_docker @pytest.mark.no_docker
@pytest.mark.from_luminous
def test_rbd_mirror_is_up(self, node, host): def test_rbd_mirror_is_up(self, node, host):
hostname = node["vars"]["inventory_hostname"] hostname = node["vars"]["inventory_hostname"]
cluster = node['cluster_name'] cluster = node['cluster_name']
@ -32,6 +65,7 @@ class TestRbdMirrors(object):
assert hostname in daemons assert hostname in daemons
@pytest.mark.docker @pytest.mark.docker
@pytest.mark.from_luminous
def test_docker_rbd_mirror_is_up(self, node, host): def test_docker_rbd_mirror_is_up(self, node, host):
hostname = node["vars"]["inventory_hostname"] hostname = node["vars"]["inventory_hostname"]
cluster = node['cluster_name'] cluster = node['cluster_name']

View File

@ -23,6 +23,7 @@ class TestRGWs(object):
assert host.service(service_name).is_enabled assert host.service(service_name).is_enabled
@pytest.mark.no_docker @pytest.mark.no_docker
@pytest.mark.from_luminous
def test_rgw_is_up(self, node, host): def test_rgw_is_up(self, node, host):
hostname = node["vars"]["inventory_hostname"] hostname = node["vars"]["inventory_hostname"]
cluster = node['cluster_name'] cluster = node['cluster_name']
@ -42,6 +43,7 @@ class TestRGWs(object):
@pytest.mark.docker @pytest.mark.docker
@pytest.mark.from_luminous
def test_docker_rgw_is_up(self, node, host): def test_docker_rgw_is_up(self, node, host):
hostname = node["vars"]["inventory_hostname"] hostname = node["vars"]["inventory_hostname"]
cluster = node['cluster_name'] cluster = node['cluster_name']