7e1b55
From b5036b5ce9ae4fab011e57fe2b37a35fdd098a70 Mon Sep 17 00:00:00 2001
7e1b55
From: Florence Blanc-Renaud <flo@redhat.com>
7e1b55
Date: Thu, 19 Aug 2021 10:51:01 +0200
7e1b55
Subject: [PATCH] ipatests: use whole date for journalctl --since
7e1b55
7e1b55
When a test is executed around midnight and is checking the
7e1b55
journal content with --since=date, it needs to specify the
7e1b55
whole date (with day and time) to avoid missing entries.
7e1b55
7e1b55
If for instance --since=23:59:00 is used and the current time is
7e1b55
now 00:01:00, --since=23:59:00 would refer to a date in the
7e1b55
future and no journal entry will be found.
7e1b55
7e1b55
Fixes: https://pagure.io/freeipa/issue/8953
7e1b55
Reviewed-By: Stanislav Levin <slev@altlinux.org>
7e1b55
Reviewed-By: Francois Cami <fcami@redhat.com>
7e1b55
---
7e1b55
 ipatests/test_integration/test_cert.py     | 2 +-
7e1b55
 ipatests/test_integration/test_commands.py | 3 ++-
7e1b55
 ipatests/test_integration/test_nfs.py      | 2 +-
7e1b55
 3 files changed, 4 insertions(+), 3 deletions(-)
7e1b55
7e1b55
diff --git a/ipatests/test_integration/test_cert.py b/ipatests/test_integration/test_cert.py
7e1b55
index 9a90db5e2..7d51b76ee 100644
7e1b55
--- a/ipatests/test_integration/test_cert.py
7e1b55
+++ b/ipatests/test_integration/test_cert.py
7e1b55
@@ -69,7 +69,7 @@ class TestInstallMasterClient(IntegrationTest):
7e1b55
 
7e1b55
         # time to look into journal logs in
7e1b55
         # test_certmonger_ipa_responder_jsonrpc
7e1b55
-        cls.since = time.strftime('%H:%M:%S')
7e1b55
+        cls.since = time.strftime('%Y-%m-%d %H:%M:%S')
7e1b55
 
7e1b55
     def test_cacert_file_appear_with_option_F(self):
7e1b55
         """Test if getcert creates cacert file with -F option
7e1b55
diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py
7e1b55
index 4d9a81652..fd5d1b472 100644
7e1b55
--- a/ipatests/test_integration/test_commands.py
7e1b55
+++ b/ipatests/test_integration/test_commands.py
7e1b55
@@ -1208,7 +1208,8 @@ class TestIPACommand(IntegrationTest):
7e1b55
         # start to look at logs a bit before "now"
7e1b55
         # https://pagure.io/freeipa/issue/8432
7e1b55
         since = time.strftime(
7e1b55
-            '%H:%M:%S', (datetime.now() - timedelta(seconds=10)).timetuple()
7e1b55
+            '%Y-%m-%d %H:%M:%S',
7e1b55
+            (datetime.now() - timedelta(seconds=10)).timetuple()
7e1b55
         )
7e1b55
 
7e1b55
         password = 'WrongPassword'
7e1b55
diff --git a/ipatests/test_integration/test_nfs.py b/ipatests/test_integration/test_nfs.py
7e1b55
index 9a6153409..dc53a6da9 100644
7e1b55
--- a/ipatests/test_integration/test_nfs.py
7e1b55
+++ b/ipatests/test_integration/test_nfs.py
7e1b55
@@ -130,7 +130,7 @@ class TestNFS(IntegrationTest):
7e1b55
         nfsclt = self.clients[1]
7e1b55
 
7e1b55
         # for journalctl --since
7e1b55
-        since = time.strftime('%H:%M:%S')
7e1b55
+        since = time.strftime('%Y-%m-%d %H:%M:%S')
7e1b55
         nfsclt.run_command(["systemctl", "restart", "rpc-gssd"])
7e1b55
         time.sleep(WAIT_AFTER_INSTALL)
7e1b55
         mountpoints = ("/mnt/krb", "/mnt/std", "/home")
7e1b55
-- 
7e1b55
2.31.1
7e1b55