Skip to content

Commit

Permalink
Perform baseline healthcheck
Browse files Browse the repository at this point in the history
Run healthcheck on a default installation and ensure that there
are no failures. This test ensures that a fresh IPA installation
will pass healthcheck.

https://bugzilla.redhat.com/show_bug.cgi?id=1774032

Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
  • Loading branch information
rcritten committed Apr 6, 2020
1 parent a087fd9 commit 3022bb5
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions ipatests/test_integration/test_ipahealthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

from __future__ import absolute_import

import json

from ipalib import api
from ipapython.ipaldap import realm_to_serverid
from ipatests.pytest_ipa.integration import tasks
from ipatests.test_integration.base import IntegrationTest

import json
import pytest

HEALTHCHECK_LOG = "/var/log/ipa/healthcheck/healthcheck.log"
HEALTHCHECK_SYSTEMD_FILE = (
"/etc/systemd/system/multi-user.target.wants/ipa-healthcheck.timer"
Expand Down Expand Up @@ -109,7 +110,8 @@
]


def run_healthcheck(host, source=None, check=None, output_type="json"):
def run_healthcheck(host, source=None, check=None, output_type="json",
failures_only=False):
"""
Run ipa-healthcheck on the remote host and return the result
Expand All @@ -132,6 +134,9 @@ def run_healthcheck(host, source=None, check=None, output_type="json"):
cmd.append("--output-type")
cmd.append(output_type)

if failures_only:
cmd.append("--failures-only")

result = host.run_command(cmd, raiseonerr=False)

if result.stdout_text:
Expand Down Expand Up @@ -371,13 +376,19 @@ def test_source_ipahealthcheck_topology_IPATopologyDomainCheck(self):
check["kw"]["suffix"] == "ca"
)

def test_source_ipa_roles_check_crlmanager(self):
@pytest.fixture
def disable_crlgen(self):
"""Fixture to disable crlgen then enable it once test is done"""
self.master.run_command(["ipa-crlgen-manage", "disable"])
yield
self.master.run_command(["ipa-crlgen-manage", "enable"])

def test_source_ipa_roles_check_crlmanager(self, disable_crlgen):
"""
This testcase checks the status of healthcheck tool
reflects correct information when crlgen is disabled
using ipa-crl-manage disable
"""
self.master.run_command(["ipa-crlgen-manage", "disable"])
returncode, data = run_healthcheck(
self.master,
"ipahealthcheck.ipa.roles",
Expand All @@ -389,6 +400,19 @@ def test_source_ipa_roles_check_crlmanager(self):
assert check["kw"]["key"] == "crl_manager"
assert check["kw"]["crlgen_enabled"] is False

def test_ipa_healthcheck_no_errors(self):
"""
Ensure that on a default installation with KRA and DNS
installed ipa-healthcheck runs with no errors.
"""
cmd = tasks.install_kra(self.master)
assert cmd.returncode == 0
returncode, _unused = run_healthcheck(
self.master,
failures_only=True
)
assert returncode == 0

def test_ipa_healthcheck_dna_plugin_returns_warning_pagure_issue_60(self):
"""
This testcase checks that the status for IPADNARangeCheck on replica
Expand Down

0 comments on commit 3022bb5

Please sign in to comment.