URL: https://github.com/freeipa/freeipa/pull/5969
Author: miskopo
 Title: #5969: ipatests: test_ipahealthcheck: Verify permissions for /var/log/ 
files
Action: opened

PR body:
"""
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 <mpolo...@redhat.com>

"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/5969/head:pr5969
git checkout pr5969
From 5e0589231e8972dbf30eac6f3988d2ebf89d5fce Mon Sep 17 00:00:00 2001
From: Michal Polovka <mpolo...@redhat.com>
Date: Tue, 10 Aug 2021 18:11:05 +0200
Subject: [PATCH 1/2] 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 <mpolo...@redhat.com>
---
 .../test_integration/test_ipahealthcheck.py   | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py
index 36fe72be785..c7e80ca8ac1 100644
--- a/ipatests/test_integration/test_ipahealthcheck.py
+++ b/ipatests/test_integration/test_ipahealthcheck.py
@@ -1227,6 +1227,33 @@ def test_sosreport_includes_healthcheck(self, create_logfile):
         )
         assert msg in cmd.stdout_text
 
+    def test_ipahealthcheck_verify_perms_for_source_files(self):
+        """
+        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
+        """
+        returncode, _ = run_healthcheck(
+            self.master, "ipahealthcheck.ipa.files")
+        assert returncode == 0
+
+        self.master.run_command(["chmod", "0644", paths.IPASERVER_INSTALL_LOG])
+        returncode, data = run_healthcheck(
+            self.master, "ipahealthcheck.ipa.files", failures_only=True)
+        try:
+            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"
+        finally:
+            self.master.run_command(
+                ["chmod", "0600", paths.IPASERVER_INSTALL_LOG])
+
     @pytest.fixture
     def remove_healthcheck(self):
         """

From ae59dea6ae3b3f52fb6a8e658d25a6ad5a9c06ee Mon Sep 17 00:00:00 2001
From: Michal Polovka <mpolo...@redhat.com>
Date: Tue, 10 Aug 2021 18:13:20 +0200
Subject: [PATCH 2/2] temp commit

---
 .freeipa-pr-ci.yaml                        | 2 +-
 ipatests/prci_definitions/temp_commit.yaml | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.freeipa-pr-ci.yaml b/.freeipa-pr-ci.yaml
index abcf8c5b634..80656690080 120000
--- a/.freeipa-pr-ci.yaml
+++ b/.freeipa-pr-ci.yaml
@@ -1 +1 @@
-ipatests/prci_definitions/gating.yaml
\ No newline at end of file
+ipatests/prci_definitions/temp_commit.yaml
\ No newline at end of file
diff --git a/ipatests/prci_definitions/temp_commit.yaml b/ipatests/prci_definitions/temp_commit.yaml
index 4b0398b9218..424728c658c 100644
--- a/ipatests/prci_definitions/temp_commit.yaml
+++ b/ipatests/prci_definitions/temp_commit.yaml
@@ -61,14 +61,14 @@ jobs:
         timeout: 1800
         topology: *build
 
-  fedora-latest/temp_commit:
+  fedora-latest/temp_commit_ipahealthcheck:
     requires: [fedora-latest/build]
     priority: 50
     job:
       class: RunPytest
       args:
         build_url: '{fedora-latest/build_url}'
-        test_suite: test_integration/test_REPLACEME.py
+        test_suite: test_integration/test_ipahealthcheck.py::TestIpaHealthCheck
         template: *ci-master-latest
-        timeout: 3600
+        timeout: 7200
         topology: *master_1repl_1client
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
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/freeipa-devel@lists.fedorahosted.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to