Enabled setting domain level explicitly in test class

Needed for replica promotion tests

https://fedorahosted.org/freeipa/ticket/5723

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Oleg Fayans
2016-03-08 12:29:35 +01:00
committed by Martin Basti
parent b1b2fc4681
commit 724b9bcf9d
2 changed files with 18 additions and 7 deletions

View File

@@ -37,6 +37,7 @@ class IntegrationTest(object):
num_ad_domains = 0
required_extra_roles = []
topology = None
domain_level = None
@classmethod
def setup_class(cls):
@@ -62,11 +63,16 @@ class IntegrationTest(object):
@classmethod
def install(cls, mh):
if cls.domain_level is not None:
domain_level = cls.domain_level
else:
domain_level = cls.master.config.domain_level
if cls.topology is None:
return
else:
tasks.install_topo(cls.topology,
cls.master, cls.replicas, cls.clients)
cls.master, cls.replicas,
cls.clients, domain_level)
@classmethod
def teardown_class(cls):
pass

View File

@@ -224,7 +224,10 @@ def enable_replication_debugging(host):
stdin_text=logging_ldif)
def install_master(host, setup_dns=True, setup_kra=False, extra_args=()):
def install_master(host, setup_dns=True, setup_kra=False, extra_args=(),
domain_level=None):
if domain_level is None:
domain_level = host.config.domain_level
host.collect_log(paths.IPASERVER_INSTALL_LOG)
host.collect_log(paths.IPACLIENT_INSTALL_LOG)
inst = host.domain.realm.replace('.', '-')
@@ -240,7 +243,7 @@ def install_master(host, setup_dns=True, setup_kra=False, extra_args=()):
'-r', host.domain.realm,
'-p', host.config.dirman_password,
'-a', host.config.admin_password,
"--domain-level=%i" % host.config.domain_level
"--domain-level=%i" % domain_level,
]
if setup_dns:
@@ -309,7 +312,9 @@ def replica_prepare(master, replica):
def install_replica(master, replica, setup_ca=True, setup_dns=False,
setup_kra=False, extra_args=()):
setup_kra=False, extra_args=(), domain_level=None):
if domain_level is None:
domain_level = domainlevel(master)
replica.collect_log(paths.IPAREPLICA_INSTALL_LOG)
replica.collect_log(paths.IPAREPLICA_CONNCHECK_LOG)
allow_sync_ptr(master)
@@ -330,7 +335,7 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
args.extend(extra_args)
if domainlevel(master) == DOMAIN_LEVEL_0:
if domain_level == DOMAIN_LEVEL_0:
# prepare the replica file on master and put it to replica, AKA "old way"
replica_prepare(master, replica)
replica_filename = get_replica_filename(replica)
@@ -976,13 +981,13 @@ def double_circle_topo(master, replicas, site_size=6):
yield site[1], site_servers[-1]
def install_topo(topo, master, replicas, clients,
def install_topo(topo, master, replicas, clients, domain_level=None,
skip_master=False, setup_replica_cas=True):
"""Install IPA servers and clients in the given topology"""
replicas = list(replicas)
installed = {master}
if not skip_master:
install_master(master)
install_master(master, domain_level=domain_level)
add_a_records_for_hosts_in_master_domain(master)