URL: https://github.com/freeipa/freeipa/pull/4950
Author: fcami
 Title: #4950: [Backport][ipa-4-8] ipatests: test_commands: 
test_login_wrong_password: look farther in time
Action: opened

PR body:
"""
Sometimes test_login_wrong_password fails because the log window the
string message is searched in is too narrow.
Broaden the window by looking at the past 10 seconds.

Fixes: https://pagure.io/freeipa/issue/8432
Signed-off-by: François Cami <[email protected]>
Reviewed-By: Rob Crittenden <[email protected]>
Reviewed-By: Florence Blanc-Renaud <[email protected]>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/4950/head:pr4950
git checkout pr4950
From 30bdf034149a0f97d279188d548a8b2e4b745c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <[email protected]>
Date: Mon, 27 Jul 2020 17:22:46 +0200
Subject: [PATCH] ipatests: test_commands: test_login_wrong_password: look
 farther in time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Sometimes test_login_wrong_password fails because the log window the
string message is searched in is too narrow.
Broaden the window by looking at the past 10 seconds.

Fixes: https://pagure.io/freeipa/issue/8432
Signed-off-by: François Cami <[email protected]>
Reviewed-By: Rob Crittenden <[email protected]>
Reviewed-By: Florence Blanc-Renaud <[email protected]>
---
 ipatests/test_integration/test_commands.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py
index bacde50416..d930f1e235 100644
--- a/ipatests/test_integration/test_commands.py
+++ b/ipatests/test_integration/test_commands.py
@@ -20,6 +20,7 @@
 
 from cryptography.hazmat.backends import default_backend
 from cryptography import x509
+from datetime import datetime, timedelta
 
 from ipalib.constants import IPAAPI_USER
 
@@ -1202,7 +1203,11 @@ def test_login_wrong_password(self, user_creation_deletion):
 
         sshconn = paramiko.SSHClient()
         sshconn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
-        since = time.strftime('%H:%M:%S')
+        # start to look at logs a bit before "now"
+        # https://pagure.io/freeipa/issue/8432
+        since = time.strftime(
+            '%H:%M:%S', (datetime.now() - timedelta(seconds=10)).timetuple()
+        )
         try:
             sshconn.connect(self.master.hostname,
                             username=self.testuser,
_______________________________________________
FreeIPA-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
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/[email protected]

Reply via email to