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

Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Felipe Barreto authored and Christian Heimes committed 2018-01-09 08:03:49 +01:00
1 parent a70dcb1e18
commit f5c01c5e86
2 files changed
+30 -12

No files matched your search

@@ -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):
+28 -11
View File
@@ -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,
),
],
),