]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: improve mds tests
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 6 Jun 2018 19:56:38 +0000 (21:56 +0200)
committerSébastien Han <seb@redhat.com>
Thu, 7 Jun 2018 06:01:58 +0000 (14:01 +0800)
the expected number of mds daemon consist of number of daemons that are
'up' + number of daemons 'up:standby'.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
tests/functional/tests/mds/test_mds.py

index 3bbc5fc5fb1ce44be68c9e8e82b457ec0dc37db8..8343821771b4d5754bda1545313b34bea8190ebb 100644 (file)
@@ -23,9 +23,9 @@ class TestMDSs(object):
     def test_mds_is_up(self, node, host):
         hostname = node["vars"]["inventory_hostname"]
         cmd = "sudo ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(cluster=node['cluster_name'])
-        output = host.check_output(cmd)
-        daemons = json.loads(output)["fsmap"]["by_rank"][0]["name"]
-        assert hostname in daemons
+        cluster_status = json.loads(host.check_output(cmd))
+
+        assert (cluster_status['fsmap'].get('up', 0) + cluster_status['fsmap'].get('up:standby', 0)) == len(node["vars"]["groups"]["mdss"])
 
     @pytest.mark.docker
     def test_docker_mds_is_up(self, node, host):
@@ -34,7 +34,6 @@ class TestMDSs(object):
             hostname=node["vars"]["inventory_hostname"],
             cluster=node["cluster_name"]
         )
-        num_mdss = len(host.ansible.get_variables()["groups"]["mdss"])
-        output_raw = host.check_output(cmd)
-        output_json = json.loads(output_raw)
-        assert output_json['fsmap']['up'] and output_json['fsmap']['in'] == num_mdss
\ No newline at end of file
+        cluster_status = json.loads(host.check_output(cmd))
+
+        assert (cluster_status['fsmap'].get('up', 0) + cluster_status['fsmap'].get('up:standby', 0)) == len(node["vars"]["groups"]["mdss"])