7e1b55
From 4a3a15f45aad016730252c09e3e173a18184603e Mon Sep 17 00:00:00 2001
7e1b55
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
7e1b55
Date: Wed, 21 Jul 2021 14:29:31 +0200
7e1b55
Subject: [PATCH] ipatests: refactor test_ipa_cert_fix with tasks
7e1b55
MIME-Version: 1.0
7e1b55
Content-Type: text/plain; charset=UTF-8
7e1b55
Content-Transfer-Encoding: 8bit
7e1b55
7e1b55
Fixes: https://pagure.io/freeipa/issue/8932
7e1b55
Signed-off-by: François Cami <fcami@redhat.com>
7e1b55
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
7e1b55
Reviewed-By: Armando Neto <abiagion@redhat.com>
7e1b55
Reviewed-By: Mohammad Rizwan <myusuf@redhat.com>
7e1b55
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
7e1b55
---
7e1b55
 ipatests/test_integration/test_ipa_cert_fix.py | 18 ++++--------------
7e1b55
 1 file changed, 4 insertions(+), 14 deletions(-)
7e1b55
7e1b55
diff --git a/ipatests/test_integration/test_ipa_cert_fix.py b/ipatests/test_integration/test_ipa_cert_fix.py
7e1b55
index fa69743e2..39904d5de 100644
7e1b55
--- a/ipatests/test_integration/test_ipa_cert_fix.py
7e1b55
+++ b/ipatests/test_integration/test_ipa_cert_fix.py
7e1b55
@@ -52,16 +52,6 @@ def check_status(host, cert_count, state, timeout=600):
7e1b55
     return count
7e1b55
 
7e1b55
 
7e1b55
-def move_date(host, chrony_state, date_str):
7e1b55
-    """Helper method to move the date on given host
7e1b55
-    :param host: The host on which date is to be moved
7e1b55
-    :param chrony_state: State to which chrony service to be moved
7e1b55
-    :param date_str: date string to move the date i.e 2years1month1days
7e1b55
-    """
7e1b55
-    host.run_command(['systemctl', chrony_state, 'chronyd'])
7e1b55
-    host.run_command(['date', '-s', date_str])
7e1b55
-
7e1b55
-
7e1b55
 def needs_resubmit(host, req_id):
7e1b55
     """Helper method to identify if cert request needs to be resubmitted
7e1b55
     :param host: the host
7e1b55
@@ -123,13 +113,13 @@ def expire_cert_critical():
7e1b55
             tasks.install_kra(host)
7e1b55
 
7e1b55
         # move date to expire certs
7e1b55
-        move_date(host, 'stop', '+3Years+1day')
7e1b55
+        tasks.move_date(host, 'stop', '+3Years+1day')
7e1b55
 
7e1b55
     yield _expire_cert_critical
7e1b55
 
7e1b55
     host = hosts.pop('host')
7e1b55
     tasks.uninstall_master(host)
7e1b55
-    move_date(host, 'start', '-3Years-1day')
7e1b55
+    tasks.move_date(host, 'start', '-3Years-1day')
7e1b55
 
7e1b55
 
7e1b55
 class TestIpaCertFix(IntegrationTest):
7e1b55
@@ -143,12 +133,12 @@ class TestIpaCertFix(IntegrationTest):
7e1b55
     def expire_ca_cert(self):
7e1b55
         tasks.install_master(self.master, setup_dns=False,
7e1b55
                              extra_args=['--no-ntp'])
7e1b55
-        move_date(self.master, 'stop', '+20Years+1day')
7e1b55
+        tasks.move_date(self.master, 'stop', '+20Years+1day')
7e1b55
 
7e1b55
         yield
7e1b55
 
7e1b55
         tasks.uninstall_master(self.master)
7e1b55
-        move_date(self.master, 'start', '-20Years-1day')
7e1b55
+        tasks.move_date(self.master, 'start', '-20Years-1day')
7e1b55
 
7e1b55
     def test_missing_csr(self, expire_cert_critical):
7e1b55
         """
7e1b55
-- 
7e1b55
2.31.1
7e1b55