From 94a6cb11eaffaff2790d7d56f092ed20111bc604 Mon Sep 17 00:00:00 2001 From: Sergey Orlov Date: Wed, 27 Mar 2019 17:43:01 +0100 Subject: [PATCH] ipatests: adapt test_trust.py for changes in multihost fixture AD hosts can now be extracted from list in respective class attributes and host domain names -- from properties provided by multihost plugin (host.domain.name). Also removed conditional skips of tests when test configuration contains only part of required AD machines as this feature never worked: multihost plugin removes all machines from config which are not explicitly requested. Related to https://pagure.io/freeipa/issue/7889 Reviewed-By: Alexander Bokovoy --- ipatests/test_integration/base.py | 2 ++ ipatests/test_integration/test_trust.py | 40 +++++-------------------- 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/ipatests/test_integration/base.py b/ipatests/test_integration/base.py index 5afe7186b..57bca6cac 100644 --- a/ipatests/test_integration/base.py +++ b/ipatests/test_integration/base.py @@ -32,6 +32,8 @@ class IntegrationTest: num_replicas = 0 num_clients = 0 num_ad_domains = 0 + num_ad_subdomains = 0 + num_ad_treedomains = 0 required_extra_roles = [] topology = None domain_level = None diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py index 5fc8afce8..9f4c502e5 100644 --- a/ipatests/test_integration/test_trust.py +++ b/ipatests/test_integration/test_trust.py @@ -32,7 +32,8 @@ class ADTrustBase(IntegrationTest): topology = 'line' num_ad_domains = 1 - optional_extra_roles = ['ad_subdomain', 'ad_treedomain'] + num_ad_subdomains = 1 + num_ad_treedomains = 1 @classmethod def install(cls, mh): @@ -40,26 +41,15 @@ class ADTrustBase(IntegrationTest): raise unittest.SkipTest("Package samba-client not available " "on {}".format(cls.master.hostname)) super(ADTrustBase, cls).install(mh) - cls.ad = cls.ad_domains[0].ads[0] + cls.ad = cls.ads[0] cls.ad_domain = cls.ad.domain.name cls.install_adtrust() cls.check_sid_generation() - # Determine whether the subdomain AD is available - try: - cls.child_ad = cls.host_by_role(cls.optional_extra_roles[0]) - cls.ad_subdomain = '.'.join( - cls.child_ad.hostname.split('.')[1:]) - except LookupError: - cls.ad_subdomain = None - - # Determine whether the tree domain AD is available - try: - cls.tree_ad = cls.host_by_role(cls.optional_extra_roles[1]) - cls.ad_treedomain = '.'.join( - cls.tree_ad.hostname.split('.')[1:]) - except LookupError: - cls.ad_treedomain = None + cls.child_ad = cls.ad_subdomains[0] + cls.ad_subdomain = cls.child_ad.domain.name + cls.tree_ad = cls.ad_treedomains[0] + cls.ad_treedomain = cls.tree_ad.domain.name cls.configure_dns_and_time() @@ -99,10 +89,6 @@ class ADTrustBase(IntegrationTest): """ Tests that all trustdomains can be found. """ - - if self.ad_subdomain is None: - raise unittest.SkipTest('AD subdomain is not available.') - result = self.master.run_command(['ipa', 'trustdomain-find', self.ad_domain]) @@ -123,12 +109,6 @@ class ADTrustSubdomainBase(ADTrustBase): tasks.configure_dns_for_trust(cls.master, cls.child_ad) tasks.sync_time(cls.master, cls.child_ad) - @classmethod - def install(cls, mh): - super(ADTrustSubdomainBase, cls).install(mh) - if not cls.ad_subdomain: - raise unittest.SkipTest('AD subdomain is not available.') - class ADTrustTreedomainBase(ADTrustBase): """ @@ -140,12 +120,6 @@ class ADTrustTreedomainBase(ADTrustBase): tasks.configure_dns_for_trust(cls.master, cls.tree_ad) tasks.sync_time(cls.master, cls.tree_ad) - @classmethod - def install(cls, mh): - super(ADTrustTreedomainBase, cls).install(mh) - if not cls.ad_treedomain: - raise unittest.SkipTest('AD tree root domain is not available.') - class TestBasicADTrust(ADTrustBase): """Basic Integration test for Active Directory"""