def client(request):
    tasks.prepare_host(request.cls.clients[0])
    tasks.install_client(request.cls.master, request.cls.clients[0])

    def teardown_client():
        tasks.uninstall_client(request.cls.clients[0])
        request.cls.delete_client_host_entry()

    request.addfinalizer(teardown_client)
Beispiel #2
0
def mh(request, class_integration_logs):
    """IPA's multihost fixture object
    """
    cls = request.cls

    domain_description = {
        'type': 'IPA',
        'hosts': {
            'master': 1,
            'replica': cls.num_replicas,
            'client': cls.num_clients,
        },
    }
    domain_description['hosts'].update(
        {role: 1 for role in cls.required_extra_roles})

    domain_descriptions = [domain_description]
    for i in range(cls.num_ad_domains):
        domain_descriptions.append({
            'type': 'AD',
            'hosts': {'ad': 1, 'ad_subdomain': 1},
        })

    mh = make_multihost_fixture(
        request,
        domain_descriptions,
        config_class=Config,
        _config=get_global_config(),
    )

    mh.domain = mh.config.domains[0]
    [mh.master] = mh.domain.hosts_by_role('master')
    mh.replicas = mh.domain.hosts_by_role('replica')
    mh.clients = mh.domain.hosts_by_role('client')

    cls.logs_to_collect = class_integration_logs

    def collect_log(host, filename):
        log.info('Adding %s:%s to list of logs to collect' %
                 (host.external_hostname, filename))
        class_integration_logs.setdefault(host, []).append(filename)

    print(mh.config)
    for host in mh.config.get_all_hosts():
        host.add_log_collector(collect_log)
        cls.log.info('Preparing host %s', host.hostname)
        tasks.prepare_host(host)

    setup_class(cls, mh)
    mh._pytestmh_request.addfinalizer(lambda: teardown_class(cls))

    yield mh.install()

    for host in cls.get_all_hosts():
        host.remove_log_collector(collect_log)

    collect_test_logs(request.node, class_integration_logs, request.config)
Beispiel #3
0
def mh(request, class_integration_logs):
    """IPA's multihost fixture object
    """
    cls = request.cls

    domain_description = {
        'type': 'IPA',
        'hosts': {
            'master': 1,
            'replica': cls.num_replicas,
            'client': cls.num_clients,
        },
    }
    domain_description['hosts'].update(
        {role: 1 for role in cls.required_extra_roles})

    domain_descriptions = [domain_description]
    for _i in range(cls.num_ad_domains):
        domain_descriptions.append({
            'type': 'AD',
            'hosts': {'ad': 1, 'ad_subdomain': 1},
        })

    mh = make_multihost_fixture(
        request,
        domain_descriptions,
        config_class=Config,
        _config=get_global_config(),
    )

    mh.domain = mh.config.domains[0]
    [mh.master] = mh.domain.hosts_by_role('master')
    mh.replicas = mh.domain.hosts_by_role('replica')
    mh.clients = mh.domain.hosts_by_role('client')

    cls.logs_to_collect = class_integration_logs

    def collect_log(host, filename):
        log.info('Adding %s:%s to list of logs to collect' %
                 (host.external_hostname, filename))
        class_integration_logs.setdefault(host, []).append(filename)

    print(mh.config)
    for host in mh.config.get_all_hosts():
        host.add_log_collector(collect_log)
        cls.log.info('Preparing host %s', host.hostname)
        tasks.prepare_host(host)

    setup_class(cls, mh)
    mh._pytestmh_request.addfinalizer(lambda: teardown_class(cls))

    yield mh.install()

    for host in cls.get_all_hosts():
        host.remove_log_collector(collect_log)

    collect_test_logs(request.node, class_integration_logs, request.config)
def client(request):
    tasks.prepare_host(request.cls.clients[0])
    tasks.install_client(request.cls.master, request.cls.clients[0])

    def teardown_client():
        tasks.uninstall_client(request.cls.clients[0])
        request.cls.delete_client_host_entry()

    request.addfinalizer(teardown_client)
 def setUp(self):
     tasks.prepare_host(self.clients[0])
     tasks.install_client(self.master, self.clients[0])
Beispiel #6
0
 def prepare_host(cls, host):
     cls.log.info('Preparing host %s', host.hostname)
     tasks.prepare_host(host)