Break out of teardown in test_replica_promotion.py if no config

These tests are all skipped if there is no YAML configuration
file passed but the teardown method is always called and since
there is a reference to the Config object this blows up if just
ipa-run-tests is executed.

Look at the config and break out if no domains are set.

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>
This commit is contained in:
Rob Crittenden 2018-04-04 11:39:40 -04:00 committed by Tibor Dudlák
parent 28acbc6c11
commit 7b546ffedb
No known key found for this signature in database
GPG Key ID: 12B8BD343576CDF5

View File

@ -11,10 +11,13 @@ from ipatests.test_integration.base import IntegrationTest
from ipatests.pytest_plugins.integration import tasks
from ipatests.pytest_plugins.integration.tasks import (
assert_error, replicas_cleanup)
from ipatests.pytest_plugins.integration.env_config import get_global_config
from ipalib.constants import (
DOMAIN_LEVEL_0, DOMAIN_LEVEL_1, DOMAIN_SUFFIX_NAME, IPA_CA_NICKNAME)
from ipaplatform.paths import paths
config = get_global_config()
class ReplicaPromotionBase(IntegrationTest):
@ -404,6 +407,9 @@ class TestWrongClientDomain(IntegrationTest):
tasks.install_master(cls.master, domain_level=cls.domain_level)
def teardown_method(self, method):
if len(config.domains) == 0:
# No YAML config was set
return
self.replicas[0].run_command(['ipa-client-install',
'--uninstall', '-U'],
raiseonerr=False)