From 81f924f49a7736b808545db0e84b3796e35c6657 Mon Sep 17 00:00:00 2001 From: sumenon Date: Jun 03 2020 07:22:55 +0000 Subject: ipatests: Test for ipahealthcheck DogtagCertsConnectivityCheck This test checks that when pki-tomcat service is stopped, DogtagCertsConnectivityCheck displays the result as ERROR Reviewed-By: Rob Crittenden Reviewed-By: Florence Blanc-Renaud Reviewed-By: Sergey Orlov --- diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py index fe10377..4a2bbb0 100644 --- a/ipatests/test_integration/test_ipahealthcheck.py +++ b/ipatests/test_integration/test_ipahealthcheck.py @@ -305,6 +305,36 @@ class TestIpaHealthCheck(IntegrationTest): self.master.run_command(["mv", TOMCAT_CFG + ".old", TOMCAT_CFG]) self.master.run_command(["ipactl", "restart"]) + @pytest.fixture + def restart_tomcat(self): + """Fixture to Stop and then start tomcat instance during test""" + self.master.run_command( + ["systemctl", "stop", "pki-tomcatd@pki-tomcat"] + ) + yield + self.master.run_command( + ["systemctl", "start", "pki-tomcatd@pki-tomcat"] + ) + + def test_ipahealthcheck_dogtag_ca_connectivity_check(self, restart_tomcat): + """ + This testcase checks that when the pki-tomcat service is stopped, + DogtagCertsConnectivityCheck displays the result as ERROR. + """ + error_msg = ( + "Request for certificate failed, " + "Certificate operation cannot be completed: " + "Unable to communicate with CMS (503)" + ) + returncode, data = run_healthcheck( + self.master, "ipahealthcheck.dogtag.ca", + "DogtagCertsConnectivityCheck", + ) + assert returncode == 1 + for check in data: + assert check["result"] == "ERROR" + assert check["kw"]["msg"] == error_msg + def test_source_ipahealthcheck_meta_core_metacheck(self): """ Testcase checks behaviour of check MetaCheck in source