From 288dcbd5c7ce33a8a5ca61b6d8ad49595b438765 Mon Sep 17 00:00:00 2001 From: Pranav Date: Sun, 4 Oct 2020 18:32:52 +0530 Subject: [TestFix] Add check to verify glusterd Error Adding check to verify gluster volume status doesn't cause any error msg in glusterd logs Change-Id: I5666aa7fb7932a7b61a56afa7d60341ef66a978e Signed-off-by: Pranav --- .../functional/glusterd/test_volume_status_xml.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/functional') diff --git a/tests/functional/glusterd/test_volume_status_xml.py b/tests/functional/glusterd/test_volume_status_xml.py index 69f1488ba..568d6906d 100644 --- a/tests/functional/glusterd/test_volume_status_xml.py +++ b/tests/functional/glusterd/test_volume_status_xml.py @@ -61,6 +61,22 @@ class TestVolumeStatusxml(GlusterBaseClass): "servers %s" % self.servers) self.get_super_method(self, 'tearDown')() + def _get_test_specific_glusterd_log(self, node): + """Gets the test specific glusterd log""" + # Extract the test specific cmds from cmd_hostory + start_msg = "Starting Test : %s : %s" % (self.id(), + self.glustotest_run_id) + end_msg = "Ending Test: %s : %s" % (self.id(), + self.glustotest_run_id) + glusterd_log = "/var/log/glusterfs/glusterd.log" + cmd = ("awk '/{}/ {{p=1}}; p; /{}/ {{p=0}}' {}" + .format(start_msg, end_msg, glusterd_log)) + ret, test_specific_glusterd_log, err = g.run(node, cmd) + self.assertEqual(ret, 0, "Failed to extract glusterd log specific" + " to the current test case. " + "Error : %s" % err) + return test_specific_glusterd_log + def test_volume_status_xml(self): # create a two node cluster @@ -109,3 +125,14 @@ class TestVolumeStatusxml(GlusterBaseClass): self.assertIsNotNone(vol_status, ("Failed to get volume " "status --xml for %s" % self.volname)) + + # Verify there are no crashes while executing gluster volume status + status = True + glusterd_log = (self._get_test_specific_glusterd_log(self.mnode) + .split("\n")) + for line in glusterd_log: + if ' E ' in glusterd_log: + status = False + g.log.info("Unexpected! Error found %s", line) + + self.assertTrue(status, "Error found in glusterd logs") -- cgit