URL: https://github.com/freeipa/freeipa/pull/5659
Author: mrizwan93
 Title: #5659: ipatests: Don't rely on certmonger to assign request id
Action: opened

PR body:
"""
There are failure observed in test_rekey_keytype_DSA(test_cert.py)
It is due to the fact that there is no guarantee that the request id
will match the filename that certmonger assigns. So just don't rely
on certmonger and specify own request id on commandline.

fixes: https://pagure.io/freeipa/issue/8725

Signed-off-by: Mohammad Rizwan <myu...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/5659/head:pr5659
git checkout pr5659
From ae984170b237f59a86c0f5c61cb27f86cedd5e8b Mon Sep 17 00:00:00 2001
From: Mohammad Rizwan <myu...@redhat.com>
Date: Tue, 23 Mar 2021 17:09:27 +0530
Subject: [PATCH] ipatests: Don't rely on certmonger to assign request id

There are failure observed in test_rekey_keytype_DSA(test_cert.py)
It is due to the fact that there is no guarantee that the request id
will match the filename that certmonger assigns. So just don't rely
on certmonger and specify own request id on commandline.

fixes: https://pagure.io/freeipa/issue/8725

Signed-off-by: Mohammad Rizwan <myu...@redhat.com>
---
 ipatests/test_integration/test_cert.py | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/ipatests/test_integration/test_cert.py b/ipatests/test_integration/test_cert.py
index b2b41427ba4..066bcea245d 100644
--- a/ipatests/test_integration/test_cert.py
+++ b/ipatests/test_integration/test_cert.py
@@ -385,28 +385,19 @@ def test_rekey_request_id(self, request_cert):
                                           '-I', self.request_id])
         assert self.request_id in result.stdout_text
 
-    def test_rekey_keytype_DSA(self):
+    def test_rekey_keytype_DSA(self, request_cert):
         """Test certmonger rekey command works fine
 
         Test is to check if -G (keytype) with DSA fails
 
         related: https://bugzilla.redhat.com/show_bug.cgi?id=1249165
         """
-        result = self.master.run_command(
-            [
-                'ipa-getcert', 'request',
-                '-f', os.path.join(paths.OPENSSL_CERTS_DIR, "test_dsa.pem"),
-                '-k', os.path.join(paths.OPENSSL_PRIVATE_DIR, "test_dsa.key"),
-                '-K', 'test/{}'.format(self.master.hostname),
-            ]
-        )
-        req_id = re.findall(r'\d+', result.stdout_text)
-        status = tasks.wait_for_request(self.master, req_id[0], 100)
+        status = tasks.wait_for_request(self.master, self.request_id, 100)
         assert status == "MONITORING"
 
         # rekey with RSA key type
         self.master.run_command(['getcert', 'rekey',
-                                 '-i', req_id[0],
+                                 '-i', self.request_id,
                                  '-g', '3072',
                                  '-G', 'DSA'])
         time.sleep(100)
@@ -414,11 +405,13 @@ def test_rekey_keytype_DSA(self):
         self.master.run_command([
             'grep',
             'DSA',
-            os.path.join(paths.CERTMONGER_REQUESTS_DIR, req_id[0]),
+            os.path.join(paths.CERTMONGER_REQUESTS_DIR, self.request_id)
         ])
 
         err_msg = 'Unable to create enrollment request: Invalid Request'
-        result = self.master.run_command(['getcert', 'list', '-i', req_id[0]])
+        result = self.master.run_command(
+            ['getcert', 'list', '-i', self.request_id]
+        )
         assert err_msg in result.stdout_text
 
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to