Disable DL0 specific tests

Disable tests that use domain level 0. Fail early to catch additional
tests that depend on DL0.

See: https://pagure.io/freeipa/issue/7669
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
This commit is contained in:
Christian Heimes
2018-08-09 09:25:52 +02:00
committed by Thomas Woerner
parent 6907a0cef7
commit 13000e2f19
3 changed files with 45 additions and 24 deletions

View File

@@ -32,6 +32,7 @@ import time
import dns import dns
from ldif import LDIFWriter from ldif import LDIFWriter
import pytest
from SSSDConfig import SSSDConfig from SSSDConfig import SSSDConfig
from six import StringIO from six import StringIO
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import serialization
@@ -45,7 +46,9 @@ from ipapython.dn import DN
from ipalib import errors from ipalib import errors
from ipalib.util import get_reverse_zone_default, verify_host_resolvable from ipalib.util import get_reverse_zone_default, verify_host_resolvable
from ipalib.constants import ( from ipalib.constants import (
DEFAULT_CONFIG, DOMAIN_SUFFIX_NAME, DOMAIN_LEVEL_0) DEFAULT_CONFIG, DOMAIN_SUFFIX_NAME, DOMAIN_LEVEL_0,
MIN_DOMAIN_LEVEL, MAX_DOMAIN_LEVEL
)
from ipatests.create_external_ca import ExternalCA from ipatests.create_external_ca import ExternalCA
from .env_config import env_to_script from .env_config import env_to_script
@@ -291,6 +294,7 @@ def install_master(host, setup_dns=True, setup_kra=False, setup_adtrust=False,
stdin_text=None, raiseonerr=True): stdin_text=None, raiseonerr=True):
if domain_level is None: if domain_level is None:
domain_level = host.config.domain_level domain_level = host.config.domain_level
check_domain_level(domain_level)
setup_server_logs_collecting(host) setup_server_logs_collecting(host)
apply_common_fixes(host) apply_common_fixes(host)
fix_apache_semaphores(host) fix_apache_semaphores(host)
@@ -335,6 +339,19 @@ def get_replica_filename(replica):
return os.path.join(replica.config.test_dir, 'replica-info.gpg') return os.path.join(replica.config.test_dir, 'replica-info.gpg')
def check_domain_level(domain_level):
if domain_level < MIN_DOMAIN_LEVEL:
pytest.fail(
"Domain level {} not supported, min level is {}.".format(
domain_level, MIN_DOMAIN_LEVEL)
)
if domain_level > MAX_DOMAIN_LEVEL:
pytest.fail(
"Domain level {} not supported, max level is {}.".format(
domain_level, MAX_DOMAIN_LEVEL)
)
def domainlevel(host): def domainlevel(host):
""" """
Dynamically determines the domainlevel on master. Needed for scenarios Dynamically determines the domainlevel on master. Needed for scenarios
@@ -347,13 +364,15 @@ def domainlevel(host):
""" """
kinit_admin(host, raiseonerr=False) kinit_admin(host, raiseonerr=False)
result = host.run_command(['ipa', 'domainlevel-get'], raiseonerr=False) result = host.run_command(['ipa', 'domainlevel-get'], raiseonerr=False)
level = 0 level = MIN_DOMAIN_LEVEL
domlevel_re = re.compile('.*(\d)') domlevel_re = re.compile('.*(\d)')
if result.returncode == 0: if result.returncode == 0:
# "domainlevel-get" command doesn't exist on ipa versions prior to 4.3 # "domainlevel-get" command doesn't exist on ipa versions prior to 4.3
level = int(domlevel_re.findall(result.stdout_text)[0]) level = int(domlevel_re.findall(result.stdout_text)[0])
check_domain_level(level)
return level return level
def master_authoritative_for_client_domain(master, client): def master_authoritative_for_client_domain(master, client):
zone = ".".join(client.hostname.split('.')[1:]) zone = ".".join(client.hostname.split('.')[1:])
result = master.run_command(["ipa", "dnszone-show", zone], result = master.run_command(["ipa", "dnszone-show", zone],
@@ -401,6 +420,7 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
raiseonerr=True): raiseonerr=True):
if domain_level is None: if domain_level is None:
domain_level = domainlevel(master) domain_level = domainlevel(master)
check_domain_level(domain_level)
apply_common_fixes(replica) apply_common_fixes(replica)
setup_server_logs_collecting(replica) setup_server_logs_collecting(replica)
allow_sync_ptr(master) allow_sync_ptr(master)
@@ -712,6 +732,7 @@ def sync_time(host, server):
def connect_replica(master, replica, domain_level=None): def connect_replica(master, replica, domain_level=None):
if domain_level is None: if domain_level is None:
domain_level = master.config.domain_level domain_level = master.config.domain_level
check_domain_level(domain_level)
if domain_level == DOMAIN_LEVEL_0: if domain_level == DOMAIN_LEVEL_0:
replica.run_command(['ipa-replica-manage', 'connect', master.hostname]) replica.run_command(['ipa-replica-manage', 'connect', master.hostname])
else: else:
@@ -726,6 +747,7 @@ def connect_replica(master, replica, domain_level=None):
def disconnect_replica(master, replica, domain_level=None): def disconnect_replica(master, replica, domain_level=None):
if domain_level is None: if domain_level is None:
domain_level = master.config.domain_level domain_level = master.config.domain_level
check_domain_level(domain_level)
if domain_level == DOMAIN_LEVEL_0: if domain_level == DOMAIN_LEVEL_0:
replica.run_command(['ipa-replica-manage', 'disconnect', master.hostname]) replica.run_command(['ipa-replica-manage', 'disconnect', master.hostname])
else: else:
@@ -1226,6 +1248,7 @@ def ipa_restore(master, backup_path):
def install_kra(host, domain_level=None, first_instance=False, raiseonerr=True): def install_kra(host, domain_level=None, first_instance=False, raiseonerr=True):
if domain_level is None: if domain_level is None:
domain_level = domainlevel(host) domain_level = domainlevel(host)
check_domain_level(domain_level)
command = ["ipa-kra-install", "-U", "-p", host.config.dirman_password] command = ["ipa-kra-install", "-U", "-p", host.config.dirman_password]
if domain_level == DOMAIN_LEVEL_0 and not first_instance: if domain_level == DOMAIN_LEVEL_0 and not first_instance:
replica_file = get_replica_filename(host) replica_file = get_replica_filename(host)
@@ -1241,6 +1264,7 @@ def install_ca(host, domain_level=None, first_instance=False,
external_ca=False, cert_files=None, raiseonerr=True): external_ca=False, cert_files=None, raiseonerr=True):
if domain_level is None: if domain_level is None:
domain_level = domainlevel(host) domain_level = domainlevel(host)
check_domain_level(domain_level)
command = ["ipa-ca-install", "-U", "-p", host.config.dirman_password, command = ["ipa-ca-install", "-U", "-p", host.config.dirman_password,
"-P", 'admin', "-w", host.config.admin_password] "-P", 'admin', "-w", host.config.admin_password]
if domain_level == DOMAIN_LEVEL_0 and not first_instance: if domain_level == DOMAIN_LEVEL_0 and not first_instance:

View File

@@ -265,6 +265,7 @@ class CALessBase(IntegrationTest):
if domain_level is None: if domain_level is None:
domain_level = tasks.domainlevel(master) domain_level = tasks.domainlevel(master)
tasks.check_domain_level(domain_level)
files_to_copy = ['root.pem'] files_to_copy = ['root.pem']
if http_pkcs12_exists: if http_pkcs12_exists:
files_to_copy.append(http_pkcs12) files_to_copy.append(http_pkcs12)
@@ -1072,8 +1073,7 @@ class TestReplicaInstall(CALessBase):
result = self.prepare_replica(http_pkcs12='server.p12', result = self.prepare_replica(http_pkcs12='server.p12',
dirsrv_pkcs12='server.p12') dirsrv_pkcs12='server.p12')
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_wildcard_http(self): def test_wildcard_http(self):
@@ -1085,8 +1085,7 @@ class TestReplicaInstall(CALessBase):
result = self.prepare_replica(http_pkcs12='http.p12', result = self.prepare_replica(http_pkcs12='http.p12',
dirsrv_pkcs12='dirsrv.p12') dirsrv_pkcs12='dirsrv.p12')
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_wildcard_ds(self): def test_wildcard_ds(self):
@@ -1098,8 +1097,7 @@ class TestReplicaInstall(CALessBase):
result = self.prepare_replica(http_pkcs12='http.p12', result = self.prepare_replica(http_pkcs12='http.p12',
dirsrv_pkcs12='dirsrv.p12') dirsrv_pkcs12='dirsrv.p12')
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_http_san(self): def test_http_san(self):
@@ -1111,8 +1109,7 @@ class TestReplicaInstall(CALessBase):
result = self.prepare_replica(http_pkcs12='http.p12', result = self.prepare_replica(http_pkcs12='http.p12',
dirsrv_pkcs12='dirsrv.p12') dirsrv_pkcs12='dirsrv.p12')
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_ds_san(self): def test_ds_san(self):
@@ -1124,8 +1121,7 @@ class TestReplicaInstall(CALessBase):
result = self.prepare_replica(http_pkcs12='http.p12', result = self.prepare_replica(http_pkcs12='http.p12',
dirsrv_pkcs12='dirsrv.p12') dirsrv_pkcs12='dirsrv.p12')
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_interactive_missing_http_pkcs_password(self): def test_interactive_missing_http_pkcs_password(self):
@@ -1139,8 +1135,7 @@ class TestReplicaInstall(CALessBase):
result = self.prepare_replica(http_pin=None, unattended=False, result = self.prepare_replica(http_pin=None, unattended=False,
stdin_text=stdin_text) stdin_text=stdin_text)
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_interactive_missing_ds_pkcs_password(self): def test_interactive_missing_ds_pkcs_password(self):
@@ -1154,8 +1149,7 @@ class TestReplicaInstall(CALessBase):
result = self.prepare_replica(dirsrv_pin=None, unattended=False, result = self.prepare_replica(dirsrv_pin=None, unattended=False,
stdin_text=stdin_text) stdin_text=stdin_text)
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_no_http_password(self): def test_no_http_password(self):
@@ -1168,8 +1162,7 @@ class TestReplicaInstall(CALessBase):
dirsrv_pkcs12='dirsrv.p12', dirsrv_pkcs12='dirsrv.p12',
http_pin='') http_pin='')
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_no_ds_password(self): def test_no_ds_password(self):
@@ -1182,8 +1175,7 @@ class TestReplicaInstall(CALessBase):
dirsrv_pkcs12='dirsrv.p12', dirsrv_pkcs12='dirsrv.p12',
dirsrv_pin='') dirsrv_pin='')
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_certs_with_no_password(self): def test_certs_with_no_password(self):
@@ -1198,8 +1190,7 @@ class TestReplicaInstall(CALessBase):
self.prepare_replica(http_pkcs12='http.p12', self.prepare_replica(http_pkcs12='http.p12',
dirsrv_pkcs12='dirsrv.p12', dirsrv_pkcs12='dirsrv.p12',
http_pin='', dirsrv_pin='') http_pin='', dirsrv_pin='')
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
@replica_install_teardown @replica_install_teardown
def test_certs_with_no_password_interactive(self): def test_certs_with_no_password_interactive(self):
@@ -1217,8 +1208,7 @@ class TestReplicaInstall(CALessBase):
http_pin=None, dirsrv_pin=None, http_pin=None, dirsrv_pin=None,
unattended=False, stdin_text=stdin_text) unattended=False, stdin_text=stdin_text)
assert result.returncode == 0 assert result.returncode == 0
if self.domain_level > DOMAIN_LEVEL_0: self.verify_installation()
self.verify_installation()
class TestClientInstall(CALessBase): class TestClientInstall(CALessBase):

View File

@@ -40,12 +40,14 @@ class ReplicaPromotionBase(IntegrationTest):
assert(found > 0), result2.stdout_text assert(found > 0), result2.stdout_text
@pytest.mark.skip(reason="Domain level 0 is not supported anymore")
class TestReplicaPromotionLevel0(ReplicaPromotionBase): class TestReplicaPromotionLevel0(ReplicaPromotionBase):
topology = 'star' topology = 'star'
num_replicas = 1 num_replicas = 1
domain_level = DOMAIN_LEVEL_0 domain_level = DOMAIN_LEVEL_0
@pytest.mark.skip(reason="Domain level 0 is not supported anymore")
@replicas_cleanup @replicas_cleanup
def test_promotion_disabled(self): def test_promotion_disabled(self):
""" """
@@ -87,6 +89,7 @@ class TestReplicaPromotionLevel0(ReplicaPromotionBase):
assert(found2 > 0), result2.stdout_text assert(found2 > 0), result2.stdout_text
@pytest.mark.skip(reason="Domain level 0 is not supported anymore")
@pytest.mark.xfail(reason="Ticket N 6274", strict=True) @pytest.mark.xfail(reason="Ticket N 6274", strict=True)
class TestKRAInstall(IntegrationTest): class TestKRAInstall(IntegrationTest):
""" """
@@ -126,6 +129,7 @@ class TestKRAInstall(IntegrationTest):
tasks.install_kra(replica2) tasks.install_kra(replica2)
@pytest.mark.skip(reason="Domain level 0 is not supported anymore")
@pytest.mark.xfail(reason="Ticket N 6274", strict=True) @pytest.mark.xfail(reason="Ticket N 6274", strict=True)
class TestCAInstall(IntegrationTest): class TestCAInstall(IntegrationTest):
topology = 'star' topology = 'star'
@@ -178,6 +182,7 @@ class TestReplicaPromotionLevel1(ReplicaPromotionBase):
num_replicas = 1 num_replicas = 1
domain_level = DOMAIN_LEVEL_1 domain_level = DOMAIN_LEVEL_1
@pytest.mark.skip(reason="Domain level 0 is not supported anymore")
@replicas_cleanup @replicas_cleanup
def test_replica_prepare_disabled(self): def test_replica_prepare_disabled(self):
replica = self.replicas[0] replica = self.replicas[0]
@@ -205,6 +210,7 @@ class TestReplicaPromotionLevel1(ReplicaPromotionBase):
'-U']) '-U'])
@pytest.mark.skip(reason="Domain level 0 is not supported anymore")
@pytest.mark.xfail(reason="Ticket N 6274", strict=True) @pytest.mark.xfail(reason="Ticket N 6274", strict=True)
class TestReplicaManageCommands(IntegrationTest): class TestReplicaManageCommands(IntegrationTest):
topology = "star" topology = "star"
@@ -372,6 +378,7 @@ class TestProhibitReplicaUninstallation(IntegrationTest):
'-U', '--ignore-topology-disconnect']) '-U', '--ignore-topology-disconnect'])
@pytest.mark.skip(reason="Domain level 0 is not supported anymore")
@pytest.mark.xfail(reason="Ticket N 6274", strict=True) @pytest.mark.xfail(reason="Ticket N 6274", strict=True)
class TestOldReplicaWorksAfterDomainUpgrade(IntegrationTest): class TestOldReplicaWorksAfterDomainUpgrade(IntegrationTest):
topology = 'star' topology = 'star'