ipatests: test_ipahealthcheck: Verify permissions for /var/log/ files

Test if files in /var/log are being checked with ipahealthcheck.ipa.files source.

Resolves: https://pagure.io/freeipa/issue/8949

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
Michal Polovka 2021-08-10 18:11:05 +02:00
parent dabf2763f8
commit d46f5b2cc3
No known key found for this signature in database
GPG Key ID: 0F9B8D77BCABF90A

View File

@ -1227,6 +1227,29 @@ class TestIpaHealthCheck(IntegrationTest):
)
assert msg in cmd.stdout_text
def test_ipahealthcheck_verify_perms_for_source_files(self,
modify_permissions):
"""
This tests checks if files in /var/log are checked with ipa.files
source.
The test modifies permissions of ipainstall log file and checks the
response from healthcheck.
https://pagure.io/freeipa/issue/8949
"""
modify_permissions(self.master, path=paths.IPASERVER_INSTALL_LOG,
mode="0644")
returncode, data = run_healthcheck(
self.master, "ipahealthcheck.ipa.files", failures_only=True)
assert returncode == 1
assert len(data) == 1
assert data[0]["result"] == "WARNING"
assert data[0]["kw"]["path"] == paths.IPASERVER_INSTALL_LOG
assert data[0]["kw"]["type"] == "mode"
assert data[0]["kw"]["expected"] == "0600"
@pytest.fixture
def remove_healthcheck(self):
"""