0fcb1e
From e76b219c21d53b6bccce4ea3d18e2b61ac835e1f Mon Sep 17 00:00:00 2001
0fcb1e
From: Mohammad Rizwan <myusuf@redhat.com>
0fcb1e
Date: Mon, 20 Feb 2023 15:33:09 +0530
0fcb1e
Subject: [PATCH] ipatests: fix tests in TestACMEPrune
0fcb1e
0fcb1e
When cron_minute + 5 > 59, cron job throwing error for it.
0fcb1e
i.e 58 + 5 = 63 which is not acceptable value for cron minute.
0fcb1e
0fcb1e
Second fix is related to mismatch of confing setting and corresponding
0fcb1e
assert.
0fcb1e
0fcb1e
Third fix is related to extending time by 60 minutes to properly
0fcb1e
expire the certs.
0fcb1e
0fcb1e
related: https://pagure.io/freeipa/issue/9294
0fcb1e
0fcb1e
Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
0fcb1e
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
0fcb1e
---
0fcb1e
 ipatests/test_integration/test_acme.py | 15 ++++++++-------
0fcb1e
 1 file changed, 8 insertions(+), 7 deletions(-)
0fcb1e
0fcb1e
diff --git a/ipatests/test_integration/test_acme.py b/ipatests/test_integration/test_acme.py
0fcb1e
index 1334be52f4530dd8b2a4207744146cd0eb5477a3..49b173060f88d4b8e876d8e3461a935938518b44 100644
0fcb1e
--- a/ipatests/test_integration/test_acme.py
0fcb1e
+++ b/ipatests/test_integration/test_acme.py
0fcb1e
@@ -600,7 +600,7 @@ def issue_and_expire_acme_cert():
0fcb1e
         # move system date to expire acme cert
0fcb1e
         for host in hosts:
0fcb1e
             tasks.kdestroy_all(host)
0fcb1e
-            tasks.move_date(host, 'stop', '+90days')
0fcb1e
+            tasks.move_date(host, 'stop', '+90days+60minutes')
0fcb1e
 
0fcb1e
         time.sleep(10)
0fcb1e
         tasks.get_kdcinfo(host)
0fcb1e
@@ -622,7 +622,7 @@ def issue_and_expire_acme_cert():
0fcb1e
 
0fcb1e
     # move back date
0fcb1e
     for host in hosts:
0fcb1e
-        tasks.move_date(host, 'start', '-90days')
0fcb1e
+        tasks.move_date(host, 'start', '-90days-60minutes')
0fcb1e
 
0fcb1e
 
0fcb1e
 class TestACMERenew(IntegrationTest):
0fcb1e
@@ -866,8 +866,9 @@ class TestACMEPrune(IntegrationTest):
0fcb1e
                 "python3",
0fcb1e
                 "-c",
0fcb1e
                 (
0fcb1e
-                    "from datetime import datetime; "
0fcb1e
-                    "print(int(datetime.now().strftime('%M')) + 5)"
0fcb1e
+                    "from datetime import datetime, timedelta; "
0fcb1e
+                    "print(int((datetime.now() + "
0fcb1e
+                    "timedelta(minutes=5)).strftime('%M')))"
0fcb1e
                 ),
0fcb1e
             ]
0fcb1e
         ).stdout_text.strip()
0fcb1e
@@ -990,11 +991,11 @@ class TestACMEPrune(IntegrationTest):
0fcb1e
         assert 'Certificate Retention Time: 30' in result.stdout_text
0fcb1e
         assert 'Certificate Retention Unit: day' in result.stdout_text
0fcb1e
         assert 'Certificate Search Size Limit: 1000' in result.stdout_text
0fcb1e
-        assert 'Certificate Search Time Limit: 100' in result.stdout_text
0fcb1e
+        assert 'Certificate Search Time Limit: 0' in result.stdout_text
0fcb1e
         assert 'Request Retention Time: 30' in result.stdout_text
0fcb1e
         assert 'Request Retention Unit: day' in result.stdout_text
0fcb1e
-        assert 'Request Search Size Limit' in result.stdout_text
0fcb1e
-        assert 'Request Search Time Limit: 100' in result.stdout_text
0fcb1e
+        assert 'Request Search Size Limit: 1000' in result.stdout_text
0fcb1e
+        assert 'Request Search Time Limit: 0' in result.stdout_text
0fcb1e
         assert 'cron Schedule: 0 0 1 * *' in result.stdout_text
0fcb1e
 
0fcb1e
     def test_prune_disable(self, issue_and_expire_acme_cert):
0fcb1e
-- 
0fcb1e
2.39.1
0fcb1e