From c77f4213e9ae78e76c5eee88ffc1cbffbb5556e8 Mon Sep 17 00:00:00 2001 From: sumenon Date: Tue, 24 Sep 2019 12:46:15 +0530 Subject: [PATCH] ipatests: Added testcase to check logrotate is added for healthcheck tool Issue: freeipa/freeipa-healthcheck#35 Reviewed-By: Florence Blanc-Renaud Reviewed-By: Rob Crittenden Reviewed-By: Mohammad Rizwan Yusuf Reviewed-By: Anuja More --- .../test_integration/test_ipahealthcheck.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py index cfa600a25..d0483459a 100644 --- a/ipatests/test_integration/test_ipahealthcheck.py +++ b/ipatests/test_integration/test_ipahealthcheck.py @@ -101,6 +101,7 @@ DEFAULT_PKI_CA_CERTS = [ "auditSigningCert cert-pki-ca", "Server-Cert cert-pki-ca", ] + DEFAULT_PKI_KRA_CERTS = [ "transportCert cert-pki-kra", "storageCert cert-pki-kra", @@ -402,6 +403,28 @@ class TestIpaHealthCheck(IntegrationTest): for check in data: assert check["result"] == "SUCCESS" + def test_ipa_healthcheck_log_rotate_file_exist_issue35(self): + """ + This test checks if log rotation has been added + for ipa-healthcheck tool so that logs are rotated + in /var/log/ipa/healthcheck folder. + The test also checks that the logrotate configuration + file is syntactically correct by calling logrotate --debug + This is a testcase for below pagure issue + https://github.com/freeipa/freeipa-healthcheck/issues/35 + """ + msg = "error: {}:".format(HEALTHCHECK_LOG_ROTATE_CONF) + tasks.uninstall_packages(self.master, HEALTHCHECK_PKG) + assert not self.master.transport.file_exists( + HEALTHCHECK_LOG_ROTATE_CONF + ) + tasks.install_packages(self.master, HEALTHCHECK_PKG) + assert self.master.transport.file_exists(HEALTHCHECK_LOG_ROTATE_CONF) + cmd = self.master.run_command( + ['logrotate', '--debug', HEALTHCHECK_LOG_ROTATE_CONF] + ) + assert msg not in cmd.stdout_text + def test_ipa_healthcheck_remove(self): """ This testcase checks the removal of of healthcheck tool