Skip to content

Commit

Permalink
Tests: Fix tests for other archs.
Browse files Browse the repository at this point in the history
The machines not running in openstack can have very long hostnames
resulting in failing tests.
  • Loading branch information
jakub-vavra-cz committed Jun 16, 2023
1 parent 54903c0 commit 62c68de
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/tests/multihost/ad/test_adparameters_ported.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,6 @@ def test_0002_ad_parameters_junk_domain(
https://bugzilla.redhat.com/show_bug.cgi?id=1091957
https://bugzilla.redhat.com/show_bug.cgi?id=2098615
"""
arch = multihost.client[0].run_command(
'uname -m', raiseonerr=False).stdout_text
if 'x86_64' not in arch:
pytest.skip("Test does not work other arch due to beaker being on"
"different network that openstack.")
hostname = multihost.client[0].run_command(
'hostname', raiseonerr=False).stdout_text.rstrip()
ad_realm = multihost.ad[0].domainname.upper()
Expand Down Expand Up @@ -344,8 +339,8 @@ def test_0002_ad_parameters_junk_domain(
f"realm leave {ad_realm}", raiseonerr=False)

# Evaluate test results
assert f"No principal matching {shortname}$@JUNK found in keytab." in \
log_str
patt = re.compile(fr'No principal matching {shortname[:15]}.*\$@JUNK found in keytab.')
assert patt.search(log_str), "The expected log message was not found!"
assert "No principal matching host/*@JUNK found in keytab." in log_str
assert f"Selected realm: {ad_realm}" in log_str
assert "segfault" not in log_msg_str, "Segfault present in the log!"
Expand Down Expand Up @@ -532,7 +527,8 @@ def test_0004_ad_parameters_valid_domain_shorthost(
su_result = client.su_success(rf'{ad_domain_short}\\{aduser}')

# Evaluate test results
assert f"Trying to find principal {shortname}$@{ad_realm}" in log_str
patt = re.compile(rf"Trying to find principal {shortname[:15]}.*\$@{ad_realm}")
assert patt.search(log_str), "The expected log message was not found!"
assert usr_cmd.returncode == 0, f"User {aduser} was not found."
assert su_result, "The su command failed!"

Expand Down Expand Up @@ -1261,7 +1257,6 @@ def test_0015_ad_parameters_ad_hostname_machine(
assert "Setting ad_hostname to [host1.kautest.com]" in log_str
assert f"Will look for host1.kautest.com@{ad_realm}" in log_str


@staticmethod
@pytest.mark.tier1_2
@pytest.mark.c_ares
Expand Down Expand Up @@ -1294,10 +1289,6 @@ def test_0016_ad_parameters_ad_hostname_valid(
1. Remove AD user.
:customerscenario: False
"""
arch = multihost.client[0].run_command(
'uname -m', raiseonerr=False).stdout_text
if 'x86_64' not in arch:
pytest.skip("Test is unstable on architectures other than x86_64.")
adjoin(membersw='adcli')
client = sssdTools(multihost.client[0], multihost.ad[0])

Expand Down Expand Up @@ -1349,10 +1340,15 @@ def test_0016_ad_parameters_ad_hostname_valid(
assert usr_cmd.returncode == 0, f"User {aduser} was not found."
assert grp_cmd.returncode == 0, f"Group {adgroup} was not found!"
assert su_result, "The su command failed!"
assert f"Option ad_hostname has value {old_hostname}" in log_str
assert f"Option ad_hostname has value {old_hostname[:15]}" in log_str
assert f"Setting ad_hostname to [{old_hostname}]" not in log_str
assert f"Will look for {old_hostname}@{ad_realm}" in log_str
assert f"Trying to find principal {old_hostname}@{ad_realm}" in log_str
patt1 = re.compile(fr'Will look for {old_hostname[:15]}.*@{ad_realm}')
assert patt1.search(log_str, re.IGNORECASE),\
'Will look for ... was not found!'
patt2 = re.compile(
fr'Trying to find principal {old_hostname[:15]}.*@{ad_realm}')
assert patt2.search(log_str, re.IGNORECASE),\
'Trying to find principal.. was not found!'

@staticmethod
@pytest.mark.tier2
Expand Down

0 comments on commit 62c68de

Please sign in to comment.