URL: https://github.com/freeipa/freeipa/pull/5010 Author: fcami Title: #5010: ipatests: test_epn: add test_EPN_connection_refused Action: opened
PR body: """ Add a test for EPN behavior when the configured SMTP does not accept connections. Fixes: https://pagure.io/freeipa/issue/8445 Signed-off-by: François Cami <fc...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/5010/head:pr5010 git checkout pr5010
From 8e43c66fa0a518458809d16e377c9bbd3db73f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fc...@redhat.com> Date: Fri, 7 Aug 2020 07:51:53 +0200 Subject: [PATCH] ipatests: test_epn: add test_EPN_connection_refused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a test for EPN behavior when the configured SMTP does not accept connections. Fixes: https://pagure.io/freeipa/issue/8445 Signed-off-by: François Cami <fc...@redhat.com> --- ipatests/test_integration/test_epn.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/ipatests/test_integration/test_epn.py b/ipatests/test_integration/test_epn.py index f4c123c6d8..9bf3d01135 100644 --- a/ipatests/test_integration/test_epn.py +++ b/ipatests/test_integration/test_epn.py @@ -175,13 +175,17 @@ def _check_epn_output( self, host, dry_run=False, + mailtest=False, from_nbdays=None, to_nbdays=None, raiseonerr=True, ): - result = tasks.ipa_epn(host, raiseonerr=raiseonerr, dry_run=dry_run, - from_nbdays=from_nbdays, - to_nbdays=to_nbdays) + result = tasks.ipa_epn( + host, raiseonerr=raiseonerr, + from_nbdays=from_nbdays, to_nbdays=to_nbdays, + dry_run=dry_run, + mailtest=mailtest + ) json.dumps(json.loads(result.stdout_text), ensure_ascii=False) return (result.stdout_text, result.stderr_text) @@ -234,6 +238,21 @@ def test_EPN_config_file(self): ck = "4c207b5c9c760c36db0d3b2b93da50ea49edcc4002d6d1e7383601f0ec30b957" assert cmd2.stdout_text.find(ck) == 0 + @pytest.mark.xfail(reason='freeipa ticket 8445', strict=True) + def test_EPN_connection_refused(self): + """Test EPN behavior when the configured SMTP is down + """ + + self.master.run_command(["systemctl", "stop", "postfix"]) + (stdout_text, stderr_text, rc) = self._check_epn_output( + self.master, mailtest=True, raiseonerr=False + ) + self.master.run_command(["systemctl", "start", "postfix"]) + assert "[Errno 111] Connection refused" not in stderr_text + assert "Could not connect to the configured SMTP server." in \ + stdout_text + assert rc > 0 + def test_EPN_smoketest_1(self): """No users except admin. Check --dry-run output. With the default configuration, the result should be an empty list.
_______________________________________________ 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