URL: https://github.com/freeipa/freeipa/pull/5989
Author: fcami
 Title: #5989: [Backport][ipa-4-9] ipatests: use whole date for journalctl 
--since
Action: opened

PR body:
"""
This PR was opened automatically because PR #5984 was pushed to master and 
backport to ipa-4-9 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/5989/head:pr5989
git checkout pr5989
From eb1ff887e3a55c008a94d92d89dce84b2a4581e3 Mon Sep 17 00:00:00 2001
From: Florence Blanc-Renaud <f...@redhat.com>
Date: Thu, 19 Aug 2021 10:51:01 +0200
Subject: [PATCH] ipatests: use whole date for journalctl --since

When a test is executed around midnight and is checking the
journal content with --since=date, it needs to specify the
whole date (with day and time) to avoid missing entries.

If for instance --since=23:59:00 is used and the current time is
now 00:01:00, --since=23:59:00 would refer to a date in the
future and no journal entry will be found.

Fixes: https://pagure.io/freeipa/issue/8953
---
 ipatests/test_integration/test_cert.py     | 2 +-
 ipatests/test_integration/test_commands.py | 3 ++-
 ipatests/test_integration/test_nfs.py      | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ipatests/test_integration/test_cert.py b/ipatests/test_integration/test_cert.py
index 9a90db5e2a2..7d51b76ee34 100644
--- a/ipatests/test_integration/test_cert.py
+++ b/ipatests/test_integration/test_cert.py
@@ -69,7 +69,7 @@ def install(cls, mh):
 
         # time to look into journal logs in
         # test_certmonger_ipa_responder_jsonrpc
-        cls.since = time.strftime('%H:%M:%S')
+        cls.since = time.strftime('%Y-%m-%d %H:%M:%S')
 
     def test_cacert_file_appear_with_option_F(self):
         """Test if getcert creates cacert file with -F option
diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py
index 4d9a8165248..fd5d1b47264 100644
--- a/ipatests/test_integration/test_commands.py
+++ b/ipatests/test_integration/test_commands.py
@@ -1208,7 +1208,8 @@ def test_login_wrong_password(self, user_creation_deletion):
         # 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()
+            '%Y-%m-%d %H:%M:%S',
+            (datetime.now() - timedelta(seconds=10)).timetuple()
         )
 
         password = 'WrongPassword'
diff --git a/ipatests/test_integration/test_nfs.py b/ipatests/test_integration/test_nfs.py
index 9a6153409d4..dc53a6da9ee 100644
--- a/ipatests/test_integration/test_nfs.py
+++ b/ipatests/test_integration/test_nfs.py
@@ -130,7 +130,7 @@ def test_krb5_nfs_manual_configuration(self):
         nfsclt = self.clients[1]
 
         # for journalctl --since
-        since = time.strftime('%H:%M:%S')
+        since = time.strftime('%Y-%m-%d %H:%M:%S')
         nfsclt.run_command(["systemctl", "restart", "rpc-gssd"])
         time.sleep(WAIT_AFTER_INSTALL)
         mountpoints = ("/mnt/krb", "/mnt/std", "/home")
_______________________________________________
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