summaryrefslogtreecommitdiffstats
path: root/ipatests/test_integration/host.py
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2013-10-16 13:54:26 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-10-31 16:52:12 +0100
commitb1bffb5ecad0fdaa2f560efd2b75c76bedc4423c (patch)
tree791e5708660c6b873e497f345b9c6639af108852 /ipatests/test_integration/host.py
parent44998feace93a01b3dfda8fce6ff7aa35fffbabf (diff)
downloadfreeipa-b1bffb5ecad0fdaa2f560efd2b75c76bedc4423c.tar.gz
freeipa-b1bffb5ecad0fdaa2f560efd2b75c76bedc4423c.tar.xz
freeipa-b1bffb5ecad0fdaa2f560efd2b75c76bedc4423c.zip
ipatests: Add support for extra roles referenced by a keyword
Adds support for host definition by a environment variables of the following form: ROLE_<keyword>_envX, where X is the number of the environment for which host referenced by a role <keyword> should be defined. Adds a required_extra_roles attribute to the IntegrationTest class, which can test developer use to specify the extra roles that this particular test requires. If not all required extra roles are available, the test will be skipped. All extra (and static) roles are accessible to the IntegrationTests via the host_by_role method, which returns a host of given role. Part of: https://fedorahosted.org/freeipa/ticket/3833
Diffstat (limited to 'ipatests/test_integration/host.py')
-rw-r--r--ipatests/test_integration/host.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ipatests/test_integration/host.py b/ipatests/test_integration/host.py
index 157c5eda8..02c82b372 100644
--- a/ipatests/test_integration/host.py
+++ b/ipatests/test_integration/host.py
@@ -97,7 +97,11 @@ class BaseHost(object):
ip = env.get('BEAKER%s%s_IP_env%s' %
(role.upper(), index, domain.index), None)
- if role == 'ad':
+ # We need to determine the type of the host, this depends on the domain
+ # type, as we assume all Unix machines are in the Unix domain and
+ # all Windows machine in a AD domain
+
+ if domain.type == 'AD':
cls = WinHost
else:
cls = Host
@@ -121,7 +125,8 @@ class BaseHost(object):
env['MYBEAKERHOSTNAME'] = self.external_hostname
env['MYIP'] = self.ip
- env['MYROLE'] = '%s%s' % (role, self.domain._env)
+ prefix = 'TESTHOST_' if self.role in self.domain.extra_roles else ''
+ env['MYROLE'] = '%s%s%s' % (prefix, role, self.domain._env)
env['MYENV'] = str(self.domain.index)
return env