]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: adds some basic tests for OSD nodes
authorAndrew Schoen <aschoen@redhat.com>
Mon, 5 Dec 2016 21:05:23 +0000 (15:05 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 6 Dec 2016 20:56:19 +0000 (14:56 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
tests/functional/tests/mon/test_mons.py
tests/functional/tests/osd/test_osds.py [new file with mode: 0644]

index fa5b389ccbc02122f9f3f49cf6381522be1a0a5a..4a72d970cf65d8b814da7682a71518c9bb00fd53 100644 (file)
@@ -15,3 +15,12 @@ class TestMons(object):
     def test_can_get_cluster_health(self, CephNode, Command):
         output = Command.check_output("sudo ceph -s")
         assert output.strip().startswith("cluster")
+
+
+class TestOSDs(object):
+
+    def test_all_osds_are_up_and_in(self, CephNode, Command):
+        output = Command.check_output("sudo ceph -s")
+        num_osds = len(CephNode["vars"]["devices"])
+        phrase = "{num_osds} osds: {num_osds} up, {num_osds} in".format(num_osds=num_osds)
+        assert phrase in output
diff --git a/tests/functional/tests/osd/test_osds.py b/tests/functional/tests/osd/test_osds.py
new file mode 100644 (file)
index 0000000..3029f16
--- /dev/null
@@ -0,0 +1,18 @@
+
+class TestOSDs(object):
+
+    def test_ceph_osd_package_is_installed(self, CephNode, Package):
+        assert Package("ceph-osd").is_installed
+
+    def test_osd_listens_on_6800(self, CephNode, Socket):
+        assert Socket("tcp://%s:6800" % CephNode["address"]).is_listening
+
+    def test_osd_services_are_running(self, CephNode, Service):
+        # TODO: figure out way to paramaterize CephNode['osd_ids'] for this test
+        for osd_id in CephNode["osd_ids"]:
+            assert Service("ceph-osd@%s" % osd_id).is_running
+
+    def test_osd_services_are_enabled(self, CephNode, Service):
+        # TODO: figure out way to paramaterize CephNode['osd_ids'] for this test
+        for osd_id in CephNode["osd_ids"]:
+            assert Service("ceph-osd@%s" % osd_id).is_enabled