On 11/26/2014 04:18 PM, Petr Viktorin wrote:
Hello,
I have split FreeIPA's multi-host testing infrastructure into a separate
project. It is temoprarily available at:
https://github.com/encukou/pytest-multihost
and I will move it to fedorahosted as soon as it's approved:
https://fedorahosted.org/fedora-infrastructure/ticket/4605
RPMs for Fedora 20..rawhide and EPEL 7 are available in COPR:
https://copr.fedoraproject.org/coprs/pviktori/pytest-plugins/
This patch contains the necessary changes to FreeIPA. The tests
themselves are almost unchanged. FreeIPA specific parts (most
importantly, logging and environ-based configuration) are also left in.
Hi Tomáš! Thanks for testing the patch and finding a problem in the
pytest-multihost library. It is now solved.
I'm also attaching two smaller patches that fix bugs in the pytest port.
--
Petr³
From aedb828ca268ad8d8e2901ebead0c1e951f4b526 Mon Sep 17 00:00:00 2001
From: Petr Viktorin
Date: Thu, 13 Nov 2014 16:23:56 +0100
Subject: [PATCH] test_integration: Use python-pytest-multihost
The core integration testing functionality was split into a separate
project. Use this project, and configure it for FreeIPA.
The "mh" (multihost) fixture is made available for integration tests.
Configuration based on environment variables is moved into a separate
module, to ease eventual deprecation.
---
freeipa.spec.in| 2 +-
ipatests/ipa-test-config | 5 +-
ipatests/ipa-test-task | 2 +
ipatests/pytest_plugins/integration.py | 117 +++---
ipatests/test_integration/base.py | 11 +-
ipatests/test_integration/config.py| 420 +++
ipatests/test_integration/env_config.py| 356 +
ipatests/test_integration/host.py | 238 +--
ipatests/test_integration/tasks.py | 2 +-
ipatests/test_integration/test_caless.py | 35 +-
.../test_forced_client_reenrollment.py | 6 +-
ipatests/test_integration/test_testconfig.py | 6 +-
ipatests/test_integration/test_trust.py| 2 +-
ipatests/test_integration/transport.py | 443 -
ipatests/test_integration/util.py | 10 -
15 files changed, 525 insertions(+), 1130 deletions(-)
create mode 100644 ipatests/test_integration/env_config.py
delete mode 100644 ipatests/test_integration/transport.py
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 9b12c20899e729cedacdee470f8f2b13250af4e0..f4218d4098204403aa86a66070439be3724461db 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -310,7 +310,7 @@ Requires: pytest >= 2.6
Requires: python-paste
Requires: python-coverage
Requires: python-polib
-Requires: python-paramiko >= 1.7.7
+Requires: python-pytest-multihost >= 0.2
Conflicts: %{alt_name}-tests
Obsoletes: %{alt_name}-tests < %{version}
diff --git a/ipatests/ipa-test-config b/ipatests/ipa-test-config
index dc94b8afb8afd6f24f0806a2fc2c74d445f2d336..6a3101f63ee5e16f675849e3390e91c39350326e 100755
--- a/ipatests/ipa-test-config
+++ b/ipatests/ipa-test-config
@@ -25,7 +25,7 @@ import argparse
import json
from ipalib.constants import FQDN
-from ipatests.test_integration import config
+from ipatests.test_integration import config, env_config
def main(argv):
@@ -92,7 +92,8 @@ def main(argv):
import yaml
return yaml.safe_dump(conf.to_dict(), default_flow_style=False)
else:
-return config.env_to_script(get_object(conf, args).to_env(**kwargs))
+env = get_object(conf, args).to_env(**kwargs)
+return env_config.env_to_script(env)
def get_object(conf, args):
diff --git a/ipatests/ipa-test-task b/ipatests/ipa-test-task
index 612974549363277fdfe101734cf9defc59c99ab8..d89af841de9f8558ca620989fb665e6f3e2c573c 100755
--- a/ipatests/ipa-test-task
+++ b/ipatests/ipa-test-task
@@ -248,6 +248,8 @@ class TaskRunner(object):
args = self.get_parser().parse_args(argv)
self.config = config.Config.from_env(os.environ)
+if not self.config:
+raise EnvironmentError('Multihost environment not configured')
logs_to_collect = {}
diff --git a/ipatests/pytest_plugins/integration.py b/ipatests/pytest_plugins/integration.py
index 5329e5190a78b37b3881fb3a5b7bd6b0c5ad215b..a6c09518ff4602d31eb37a9cbc27be3ae752ea29 100644
--- a/ipatests/pytest_plugins/integration.py
+++ b/ipatests/pytest_plugins/integration.py
@@ -24,10 +24,13 @@
import shutil
import pytest
+from pytest_multihost import make_multihost_fixture
from ipapython import ipautil
from ipapython.ipa_log_manager import log_mgr
-from ipatests.test_integration.config import get_global_config
+from ipatests.test_integration import tasks
+from ipatests.test_integration.config import Config
+from ipatests.test_integration.env_config import get_global_config
log = log_mgr.get_