Blob Blame History Raw
From e76b219c21d53b6bccce4ea3d18e2b61ac835e1f Mon Sep 17 00:00:00 2001
From: Mohammad Rizwan <myusuf@redhat.com>
Date: Mon, 20 Feb 2023 15:33:09 +0530
Subject: [PATCH] ipatests: fix tests in TestACMEPrune

When cron_minute + 5 > 59, cron job throwing error for it.
i.e 58 + 5 = 63 which is not acceptable value for cron minute.

Second fix is related to mismatch of confing setting and corresponding
assert.

Third fix is related to extending time by 60 minutes to properly
expire the certs.

related: https://pagure.io/freeipa/issue/9294

Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
---
 ipatests/test_integration/test_acme.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/ipatests/test_integration/test_acme.py b/ipatests/test_integration/test_acme.py
index 1334be52f4530dd8b2a4207744146cd0eb5477a3..49b173060f88d4b8e876d8e3461a935938518b44 100644
--- a/ipatests/test_integration/test_acme.py
+++ b/ipatests/test_integration/test_acme.py
@@ -600,7 +600,7 @@ def issue_and_expire_acme_cert():
         # move system date to expire acme cert
         for host in hosts:
             tasks.kdestroy_all(host)
-            tasks.move_date(host, 'stop', '+90days')
+            tasks.move_date(host, 'stop', '+90days+60minutes')
 
         time.sleep(10)
         tasks.get_kdcinfo(host)
@@ -622,7 +622,7 @@ def issue_and_expire_acme_cert():
 
     # move back date
     for host in hosts:
-        tasks.move_date(host, 'start', '-90days')
+        tasks.move_date(host, 'start', '-90days-60minutes')
 
 
 class TestACMERenew(IntegrationTest):
@@ -866,8 +866,9 @@ class TestACMEPrune(IntegrationTest):
                 "python3",
                 "-c",
                 (
-                    "from datetime import datetime; "
-                    "print(int(datetime.now().strftime('%M')) + 5)"
+                    "from datetime import datetime, timedelta; "
+                    "print(int((datetime.now() + "
+                    "timedelta(minutes=5)).strftime('%M')))"
                 ),
             ]
         ).stdout_text.strip()
@@ -990,11 +991,11 @@ class TestACMEPrune(IntegrationTest):
         assert 'Certificate Retention Time: 30' in result.stdout_text
         assert 'Certificate Retention Unit: day' in result.stdout_text
         assert 'Certificate Search Size Limit: 1000' in result.stdout_text
-        assert 'Certificate Search Time Limit: 100' in result.stdout_text
+        assert 'Certificate Search Time Limit: 0' in result.stdout_text
         assert 'Request Retention Time: 30' in result.stdout_text
         assert 'Request Retention Unit: day' in result.stdout_text
-        assert 'Request Search Size Limit' in result.stdout_text
-        assert 'Request Search Time Limit: 100' in result.stdout_text
+        assert 'Request Search Size Limit: 1000' in result.stdout_text
+        assert 'Request Search Time Limit: 0' in result.stdout_text
         assert 'cron Schedule: 0 0 1 * *' in result.stdout_text
 
     def test_prune_disable(self, issue_and_expire_acme_cert):
-- 
2.39.1