URL: https://github.com/freeipa/freeipa/pull/4928
Author: menonsudhir
 Title: #4928: ipatests: Test to check IPACAChainExpirationCheck when IPA cacrt 
is renamed
Action: opened

PR body:
"""
This testcase checks that ERROR message is displayed by 
IPACAChainExpirationCheck when ipa ca crt file is renamed.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/4928/head:pr4928
git checkout pr4928
From 55d45dc82a5f073a0f2d2310bc4a88965558635f Mon Sep 17 00:00:00 2001
From: sumenon <sume...@redhat.com>
Date: Fri, 17 Jul 2020 19:47:16 +0530
Subject: [PATCH 1/2] ipatests: Test to check IPACAChainExpirationCheck when
 IPA cacrt is renamed

This testcase checks that ERROR message is displayed
by IPACAChainExpirationCheck when ipa ca crt file is renamed.
---
 .../test_integration/test_ipahealthcheck.py   | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py
index ac13dbdfb3..b405e46a4c 100644
--- a/ipatests/test_integration/test_ipahealthcheck.py
+++ b/ipatests/test_integration/test_ipahealthcheck.py
@@ -723,6 +723,37 @@ def test_run_with_stopped_master(self, ipactl):
         errors = re.findall("ERROR: .*: not running", output)
         assert len(errors) == len(output.split('\n'))
 
+    @pytest.fixture()
+    def move_ipa_ca_crt(self):
+        """
+        Fixture to move ipa_ca_crt and revert
+        """
+        self.master.run_command(
+            ["mv", paths.IPA_CA_CRT, paths.IPA_CA_CRT + ".old"]
+        )
+        yield
+        self.master.run_command(
+            ["mv", paths.IPA_CA_CRT + ".old", paths.IPA_CA_CRT]
+        )
+
+    def test_chainexpiration_check_without_file(self, move_ipa_ca_crt):
+        """
+        Testcase checks that ERROR message is displayed 
+        when ipa ca crt file is not renamed
+        """
+        error_msg = "Error opening IPA CA chain at {}: ".format(paths.IPA_CA_CRT)
+             "[Errno 2] No such file or directory: '{}'".format(paths.IPA_CA_CRT)
+        returncode, data = run_healthcheck(
+            self.master,
+            "ipahealthcheck.ipa.certs",
+            "IPACAChainExpirationCheck",
+        )
+        assert returncode == 1
+        for check in data:
+                assert check["result"] == "ERROR"
+                assert check["kw"]["key"] == paths.IPA_CA_CRT
+                assert check["kw"]["msg"] == error_msg
+
     def test_ipa_healthcheck_remove(self):
         """
         This testcase checks the removal of of healthcheck tool

From 83726e729d5d3b7532ab817727fb86487e01a762 Mon Sep 17 00:00:00 2001
From: sumenon <sume...@redhat.com>
Date: Fri, 17 Jul 2020 20:04:30 +0530
Subject: [PATCH 2/2] Temp Commit

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

diff --git a/.freeipa-pr-ci.yaml b/.freeipa-pr-ci.yaml
index abcf8c5b63..8065669008 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 e337068145..b44fe8dfcf 100644
--- a/ipatests/prci_definitions/temp_commit.yaml
+++ b/ipatests/prci_definitions/temp_commit.yaml
@@ -68,7 +68,7 @@ jobs:
       class: RunPytest
       args:
         build_url: '{fedora-latest/build_url}'
-        test_suite: test_integration/test_REPLACEME.py
+        test_suite: test_integration/test_ipahealthcheck.py::TestIpaHealthCheck::test_chainexpiration_check_without_cert
         template: *ci-master-latest
         timeout: 3600
-        topology: *master_1repl_1client
+        topology: *master_1repl
_______________________________________________
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

Reply via email to