ipatests: xfail for test_ipahealthcheck_hidden_replica to respect pki version

Change xfail for test_replica_promotion.py/TestHiddenReplicaPromotion/test_ipahealthcheck_hidden_replica
to respect platform and pki version as the related issue is fixed.

Implement tasks/get_platform_version which returns a platform version
number(s) of a provided host in a form of a tuple.

Related: https://pagure.io/freeipa/issue/8582

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Michal Polovka committed 2022-06-15 10:03:00 +02:00
1 parent 86acb96e38
commit e46dd73a9a
2 files changed
+29 -4

No files matched your search

+12
View File
@@ -2462,6 +2462,18 @@ def get_platform(host):
return result.stdout_text.strip()
def get_platform_version(host):
result = host.run_command([
'python3', '-c',
'from ipaplatform.osinfo import OSInfo; print(OSInfo().version_number)'
], raiseonerr=False)
assert result.returncode == 0
# stdout_text is a str in format "(X, Y)" and needs to be
# converted back to a functional tuple. This approach works with
# any number of version numbers filled, e.g. (34, ) or (8, 6) etc.
return tuple(map(int, re.findall(r'[0-9]+', result.stdout_text.strip())))
def install_packages(host, pkgs):
"""Install packages on a remote host.
:param host: the host where the installation takes place
@@ -31,6 +31,7 @@ from ipatests.test_integration.test_dns_locations import (
)
from ipapython.dnsutil import DNSName
from ipalib.constants import IPA_CA_RECORD
from ipatests.util import xfail_context
config = get_global_config()
@@ -1031,13 +1032,14 @@ class TestHiddenReplicaPromotion(IntegrationTest):
self._check_dnsrecords([self.master], [self.replicas[0]])
self._check_config([self.master], [self.replicas[0]])
@pytest.mark.xfail(
reason='https://pagure.io/freeipa/issue/8582', strict=True
)
def test_ipahealthcheck_hidden_replica(self):
"""Ensure that ipa-healthcheck runs successfully on all members
of an IPA cluster that includes a hidden replica.
"""
os_version = (tasks.get_platform(self.master),
tasks.get_platform_version(self.master))
pki_version = tasks.get_pki_version(self.master)
# verify state
self._check_config([self.master], [self.replicas[0]])
# A DNA range is needed on the replica for ipa-healthcheck to work.
@@ -1049,7 +1051,18 @@ class TestHiddenReplicaPromotion(IntegrationTest):
srv,
failures_only=True
)
assert returncode == 0
pki_too_old = \
(os_version[0] == 'fedora'
and pki_version < tasks.parse_version('11.1.0'))\
or (os_version[0] == 'rhel'
and os_version[1][0] == 8
and pki_version < tasks.parse_version('10.12.0'))\
or (os_version[0] == 'rhel'
and os_version[1][0] == 9
and pki_version < tasks.parse_version('11.0.4'))
with xfail_context(pki_too_old,
'https://pagure.io/freeipa/issue/8582'):
assert returncode == 0
def test_hide_last_visible_server_fails(self):
# verify state