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