From 81a0fdfea49e39c4ea0253c3e773d8625069cf9d Mon Sep 17 00:00:00 2001 From: François Cami Date: Jul 29 2020 15:21:31 +0000 Subject: ipatests: test_commands: test_login_wrong_password: look farther in time 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 Reviewed-By: Rob Crittenden Reviewed-By: Florence Blanc-Renaud Reviewed-By: Rob Crittenden Reviewed-By: Florence Blanc-Renaud --- diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py index fa54e8a..7d38722 100644 --- a/ipatests/test_integration/test_commands.py +++ b/ipatests/test_integration/test_commands.py @@ -21,6 +21,7 @@ from subprocess import CalledProcessError from cryptography.hazmat.backends import default_backend from cryptography import x509 +from datetime import datetime, timedelta from ipalib.constants import IPAAPI_USER @@ -904,7 +905,11 @@ class TestIPACommand(IntegrationTest): 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,