URL: https://github.com/freeipa/freeipa/pull/4108 Author: menonsudhir Title: #4108: Tier-1 test for ipa-healthcheck tool Action: opened
PR body: """ Signed-off-by: sumenon <[email protected]> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/4108/head:pr4108 git checkout pr4108
From a2b77e371698964af0bf3395f2ef772944a45367 Mon Sep 17 00:00:00 2001 From: sumenon <[email protected]> Date: Thu, 9 Jan 2020 14:47:08 +0530 Subject: [PATCH] Tier-1 test for ipa-healthcheck tool Signed-off-by: sumenon <[email protected]> --- .../test_integration/test_ipahealthcheck.py | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 ipatests/test_integration/test_ipahealthcheck.py diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py new file mode 100644 index 0000000000..3bb1102813 --- /dev/null +++ b/ipatests/test_integration/test_ipahealthcheck.py @@ -0,0 +1,168 @@ +# +# Copyright (C) 2018 FreeIPA Contributors see COPYING for license +# + +""" +Tests to verify that the ipa-healthcheck scenarios +""" + +from __future__ import absolute_import + + +from ipatests.test_integration.base import IntegrationTest +from ipatests.pytest_ipa.integration import tasks +from ipaplatform.paths import paths + +import json + +HEALTHCHECK_LOG = "/var/log/ipa/healthcheck/healthcheck.log" +HEALTHCHECK_SYSTEMD_FILE = ( + "/etc/systemd/system/multi-user.target.wants/ipa-healthcheck.timer" +) +HEALTHCHECK_LOGROTATE_CONF = "/etc/logrotate.d/ipahealthcheck" +HEALTHCHECK_LOG_DIR = "/var/log/ipa/healthcheck" + + +def format_output(outputfile): + """ + Helper function which parses the output.json file which is + created when ipa-healthcheck command is executed + """ + with open(outputfile, "r") as f: + data = json.load(f) + return data + + +sources = [ + "ipahealthcheck.dogtag.ca", + "ipahealthcheck.ds.replication", + "ipahealthcheck.dogtag.ca", + "ipahealthcheck.ipa.certs", + "ipahealthcheck.ipa.dna", + "ipahealthcheck.ipa.idns", + "ipahealthcheck.ipa.files", + "ipahealthcheck.ipa.host", + "ipahealthcheck.ipa.roles", + "ipahealthcheck.ipa.topology", + "ipahealthcheck.ipa.trust", + "ipahealthcheck.meta.services", +] + +ipa_cert_checks = [ + "IPACertmongerExpirationCheck", + "IPACertfileExpirationCheck", + "IPACertTracking", + "IPACertNSSTrust", + "IPANSSChainValidation", + "IPAOpenSSLChainValidation", + "IPARAAgent", + "IPACertRevocation", + "IPACertmongerCA", + "IPACAChainExpirationCheck", +] + +ipatrust_checks = [ + "IPATrustAgentCheck", + "IPATrustDomainsCheck", + "IPADomainCheck", + "IPATrustCatalogCheck", + "IPAsidgenpluginCheck", + "IPATrustAgentMemberCheck", + "IPATrustControllerPrincipalCheck", + "IPATrustControllerServiceCheck", + "IPATrustControllerConfCheck", + "IPATrustControllerGroupSIDCheck", + "IPATrustPackageCheck", +] + +metaservices_checks = [ + "certmonger", + "dirsrv", + "gssproxy", + "httpd", + "ipa_custodia", + "ipa_dnskeysyncd", + "ipa_otpd", + "kadmin", + "krb5kdc", + "named", + "pki_tomcatd", + "sssd", +] + +ipafiles_checks = ["IPAFileNSSDBCheck", "IPAFileCheck", "TomcatFileCheck"] +dogtag_checks = ["DogtagCertsConfigCheck", "DogtagCertsConnectivityCheck"] +iparoles_checks = ["IPACRLManagerCheck", "IPARenewalMasterCheck"] +replication_checks = ["ReplicationConflictCheck"] +ruv_checks = ["RUVCheck"] +dna_checks = ["IPADNARangeCheck"] +idns_checks = ["IPADNSSystemRecordsCheck"] +ipahost_checks = ["IPAHostKeytab"] +ipatopology_checks = ["IPATopologyDomainCheck"] +filesystem_checks = ["FileSystemSpaceCheck"] +metacore_checks = ["MetaCheck"] + + +class TestIpaHealthCheck(IntegrationTest): + """ + Check that ipa healthcheck tool return WARNING if no range is set. + https://github.com/freeipa/freeipa-healthcheck/issues/60 + """ + + num_replicas = 1 + + @classmethod + def install(cls, mh): + tasks.install_master(cls.master, setup_dns=True) + cls.replica = cls.replicas[0] + tasks.install_replica(cls.master, cls.replicas[0], setup_kra=False) + + def test_ipa_healthcheck_install_on_master(self): + result = self.master.run_command( + ["dnf", "install", "-y", "freeipa-healthcheck"] + ) + assert result.returncode == 0 + + def test_ipa_healthcheck_install_on_replica(self): + result = self.replica.run_command( + ["dnf", "install", "-y", "freeipa-healthcheck"] + ) + assert result.returncode == 0 + + def test_run_ipahealthcheck_list_source(self): + result = self.master.run_command(["ipa-healthcheck", "--list-sources"]) + assert result.returncode == 0 + for source in sources: + assert source in result.stdout_text + + def test_dogtag_ca_check_exists(self): + result = self.master.run_command( + ["ipa-healthcheck", "--source", "ipahealthcheck.dogtag.ca"] + ) + for check in dogtag_checks: + assert check in result.stdout_text + + def test_replication_check_exists(self): + result = self.master.run_command( + ["ipa-healthcheck", "--source", "ipahealthcheck.ds.replication"] + ) + for check in replication_checks: + assert check in result.stdout_text + + def test_ipa_cert_check_exists(self): + result = self.master.run_command( + ["ipa-healthcheck", "--source", "ipahealthcheck.ipa.certs"] + ) + for check in ipa_cert_checks: + assert check in result.stdout_text + + def test_ipa_trust_check_exists(self): + result = self.master.run_command( + ["ipa-healthcheck", "--source", "ipahealthcheck.ipa.trust"] + ) + for check in ipatrust_checks: + assert check in result.stdout_text + + def test_ipa_healthcheck_remove(self): + cmd = self.master.run_command(["dnf", "remove", "-y", "freeipa-healthcheck"]) + assert cmd.returncode == 0
_______________________________________________ FreeIPA-devel mailing list -- [email protected] To unsubscribe send an email to [email protected] Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/[email protected]
