URL: https://github.com/freeipa/freeipa/pull/1445
Author: tiran
 Title: #1445: [Backport][ipa-4-6] Fixing test_testconfig with proper asserts
Action: opened

PR body:
"""
This PR was opened automatically because PR #1431 was pushed to master and 
backport to ipa-4-6 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1445/head:pr1445
git checkout pr1445
From 2033e756bb91283d722b029aa3eae536bfd71c11 Mon Sep 17 00:00:00 2001
From: Felipe Barreto <fbarr...@redhat.com>
Date: Wed, 3 Jan 2018 16:09:32 -0200
Subject: [PATCH] Fixing test_testconfig with proper asserts

When the cls in env_config.py is a WinHost, the __init__ receives different
parameters. Now, it's adapted to all different kinds of hosts.

Also, it's necessary to add the host_type field to most of domains created
in the test classes, because the field is returned by pytest_multihost.Config
in pytest_plugins/integration/config.py::Config::to_dict

https://pagure.io/freeipa/issue/7346
---
 ipatests/pytest_plugins/integration/env_config.py |  3 +-
 ipatests/test_integration/test_testconfig.py      | 39 ++++++++++++++++-------
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/ipatests/pytest_plugins/integration/env_config.py b/ipatests/pytest_plugins/integration/env_config.py
index d140aa9df6..5208cc0f29 100644
--- a/ipatests/pytest_plugins/integration/env_config.py
+++ b/ipatests/pytest_plugins/integration/env_config.py
@@ -334,7 +334,8 @@ def host_from_env(env, domain, hostname, role, index, domain_index):
 
     cls = domain.get_host_class({})
 
-    return cls(domain, hostname, role, ip, external_hostname)
+    return cls(domain, hostname, role, ip=ip,
+               external_hostname=external_hostname)
 
 
 def host_to_env(host, **kwargs):
diff --git a/ipatests/test_integration/test_testconfig.py b/ipatests/test_integration/test_testconfig.py
index b495f368e4..aaba1621c9 100644
--- a/ipatests/test_integration/test_testconfig.py
+++ b/ipatests/test_integration/test_testconfig.py
@@ -152,7 +152,7 @@ class TestMinimalConfig(CheckConfig):
     extra_input_dict = dict(
         domains=[
             dict(name='ipadomain.test', type='IPA', hosts=[
-                dict(name='master', ip='192.0.2.1'),
+                dict(name='master', ip='192.0.2.1', host_type=None),
             ]),
         ],
     )
@@ -171,6 +171,7 @@ class TestMinimalConfig(CheckConfig):
                         ip="192.0.2.1",
                         external_hostname="master.ipadomain.test",
                         role="master",
+                        host_type=None,
                     ),
                 ],
             ),
@@ -212,23 +213,29 @@ class TestComplexConfig(CheckConfig):
     extra_input_dict = dict(
         domains=[
             dict(name='ipadomain.test', type='IPA', hosts=[
-                dict(name='master', ip='192.0.2.1', role='master'),
-                dict(name='replica1', ip='192.0.2.2', role='replica'),
+                dict(name='master', ip='192.0.2.1', role='master',
+                     host_type=None),
+                dict(name='replica1', ip='192.0.2.2', role='replica',
+                     host_type=None),
                 dict(name='replica2', ip='192.0.2.3', role='replica',
-                              external_hostname='r2.ipadomain.test'),
-                dict(name='client1', ip='192.0.2.4', role='client'),
+                     external_hostname='r2.ipadomain.test', host_type=None),
+                dict(name='client1', ip='192.0.2.4', role='client',
+                     host_type=None),
                 dict(name='client2', ip='192.0.2.5', role='client',
-                              external_hostname='c2.ipadomain.test'),
-                dict(name='extra', ip='192.0.2.6', role='extrarole'),
-                dict(name='extram1', ip='192.0.2.7', role='extrarolem'),
+                     external_hostname='c2.ipadomain.test', host_type=None),
+                dict(name='extra', ip='192.0.2.6', role='extrarole',
+                     host_type=None),
+                dict(name='extram1', ip='192.0.2.7', role='extrarolem',
+                     host_type=None),
                 dict(name='extram2', ip='192.0.2.8', role='extrarolem',
-                              external_hostname='e2.ipadomain.test'),
+                     external_hostname='e2.ipadomain.test', host_type=None),
             ]),
             dict(name='addomain.test', type='AD', hosts=[
-                dict(name='ad', ip='192.0.2.33', role='ad'),
+                dict(name='ad', ip='192.0.2.33', role='ad', host_type=None),
             ]),
             dict(name='ipadomain2.test', type='IPA', hosts=[
-                dict(name='master.ipadomain2.test', ip='192.0.2.65'),
+                dict(name='master.ipadomain2.test', ip='192.0.2.65',
+                     host_type=None),
             ]),
         ],
     )
@@ -267,48 +274,56 @@ class TestComplexConfig(CheckConfig):
                         ip="192.0.2.1",
                         external_hostname="master.ipadomain.test",
                         role="master",
+                        host_type=None,
                     ),
                     dict(
                         name='replica1.ipadomain.test',
                         ip="192.0.2.2",
                         external_hostname="replica1.ipadomain.test",
                         role="replica",
+                        host_type=None,
                     ),
                     dict(
                         name='replica2.ipadomain.test',
                         ip="192.0.2.3",
                         external_hostname="r2.ipadomain.test",
                         role="replica",
+                        host_type=None,
                     ),
                     dict(
                         name='client1.ipadomain.test',
                         ip="192.0.2.4",
                         external_hostname="client1.ipadomain.test",
                         role="client",
+                        host_type=None,
                     ),
                     dict(
                         name='client2.ipadomain.test',
                         ip="192.0.2.5",
                         external_hostname="c2.ipadomain.test",
                         role="client",
+                        host_type=None,
                     ),
                     dict(
                         name='extra.ipadomain.test',
                         ip="192.0.2.6",
                         external_hostname="extra.ipadomain.test",
                         role="extrarole",
+                        host_type=None,
                     ),
                     dict(
                         name='extram1.ipadomain.test',
                         ip="192.0.2.7",
                         external_hostname="extram1.ipadomain.test",
                         role="extrarolem",
+                        host_type=None,
                     ),
                     dict(
                         name='extram2.ipadomain.test',
                         ip="192.0.2.8",
                         external_hostname="e2.ipadomain.test",
                         role="extrarolem",
+                        host_type=None,
                     ),
                 ],
             ),
@@ -321,6 +336,7 @@ class TestComplexConfig(CheckConfig):
                         ip="192.0.2.33",
                         external_hostname="ad.addomain.test",
                         role="ad",
+                        host_type=None,
                     ),
                 ],
             ),
@@ -333,6 +349,7 @@ class TestComplexConfig(CheckConfig):
                         ip="192.0.2.65",
                         external_hostname="master.ipadomain2.test",
                         role="master",
+                        host_type=None,
                     ),
                 ],
             ),
_______________________________________________
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