URL: https://github.com/freeipa/freeipa/pull/1236
Author: tomaskrizek
 Title: #1236: [Backport][ipa-4-5] prci: add external_ca test
Action: opened

PR body:
"""
Backport of #1027 
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1236/head:pr1236
git checkout pr1236
From 2d7ed9607ad7aa6fed892c3b4d9e18d2bc0712b6 Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tkri...@redhat.com>
Date: Thu, 31 Aug 2017 14:49:45 +0200
Subject: [PATCH 1/2] prci: add external_ca test

Add external_ca to the PR CI test suite.

Signed-off-by: Tomas Krizek <tkri...@redhat.com>
---
 .freeipa-pr-ci.yaml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/.freeipa-pr-ci.yaml b/.freeipa-pr-ci.yaml
index f0adda6225..a3d2a0dbdd 100644
--- a/.freeipa-pr-ci.yaml
+++ b/.freeipa-pr-ci.yaml
@@ -33,3 +33,14 @@ jobs:
         test_suite: test_integration/test_caless.py::TestServerReplicaCALessToCAFull
         template: *ci-ipa-4-5-f26
         timeout: 3600
+
+  fedora-26/external_ca:
+    requires: [fedora-26/build]
+    priority: 50
+    job:
+      class: RunPytest
+      args:
+        build_url: '{fedora-26/build_url}'
+        test_suite: test_integration/test_external_ca.py::TestExternalCA
+        template: *ci-ipa-4-5-f26
+        timeout: 3600

From d86feb0420597a73c594ed423ea0f8d886118c9d Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tkri...@redhat.com>
Date: Wed, 6 Sep 2017 17:22:19 +0200
Subject: [PATCH 2/2] ipatests: collect logs for external_ca test suite

Since test_external_ca isn't using the multihost framework,
logs collection has to be set up explicitly.

Signed-off-by: Tomas Krizek <tkri...@redhat.com>
---
 ipatests/test_integration/test_external_ca.py |  2 ++
 ipatests/util.py                              | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/ipatests/test_integration/test_external_ca.py b/ipatests/test_integration/test_external_ca.py
index 7fc89cc949..171c0ee0d4 100644
--- a/ipatests/test_integration/test_external_ca.py
+++ b/ipatests/test_integration/test_external_ca.py
@@ -21,6 +21,7 @@
 
 from ipatests.pytest_plugins.integration import tasks
 from ipatests.test_integration.base import IntegrationTest
+from ipatests.util import collect_logs
 
 
 EXTERNAL_CA_KEY_ID = base64.b64encode(os.urandom(64))
@@ -31,6 +32,7 @@ class TestExternalCA(IntegrationTest):
     """
     Test of FreeIPA server installation with exernal CA
     """
+    @collect_logs
     def test_external_ca(self):
         # Step 1 of ipa-server-install
         self.master.run_command([
diff --git a/ipatests/util.py b/ipatests/util.py
index bafc590630..fb43b6db80 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -43,6 +43,9 @@
 from ipalib.request import context
 from ipapython.dn import DN
 from ipapython.ipautil import run
+from ipatests.pytest_plugins.integration.tasks import (
+    setup_server_logs_collecting)
+
 
 try:
     # not available with client-only wheel packages
@@ -834,3 +837,19 @@ def get_group_dn(cn):
 
 def get_user_dn(uid):
     return DN(('uid', uid), api.env.container_user, api.env.basedn)
+
+
+def collect_logs(func):
+    def wrapper(*args):
+        try:
+            func(*args)
+        finally:
+            if hasattr(args[0], 'master'):
+                setup_server_logs_collecting(args[0].master)
+            if hasattr(args[0], 'replicas') and args[0].replicas:
+                for replica in args[0].replicas:
+                    setup_server_logs_collecting(replica)
+            if hasattr(args[0], 'clients') and args[0].clients:
+                for client in args[0].clients:
+                    setup_server_logs_collecting(client)
+    return wrapper
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to