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 <tkrizek@redhat.com>
Reviewed-By: Felipe Barreto <fbarreto@redhat.com>
This commit is contained in:
Tomas Krizek 2017-09-06 17:22:19 +02:00
parent 0033e09339
commit 1d190092d3
No known key found for this signature in database
GPG Key ID: 22A2A94B5E49415A
2 changed files with 21 additions and 0 deletions

View File

@ -20,12 +20,14 @@ import os
from ipatests.pytest_plugins.integration import tasks
from ipatests.test_integration.base import IntegrationTest
from ipatests.test_integration.create_external_ca import ExternalCA
from ipatests.util import collect_logs
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([

View File

@ -43,6 +43,9 @@ from ipalib.plugable import Plugin
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
@ -852,3 +855,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