Skip to content

Commit

Permalink
Add workaround for BZ:2255264 and extend for OS version check
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
  • Loading branch information
Gauravtalreja1 committed Mar 21, 2024
1 parent e0233ef commit eeab424
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion tests/foreman/cli/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

from robottelo.config import settings
from robottelo.constants import FOREMAN_PROVIDERS
from robottelo.hosts import ContentHost
from robottelo.utils.issue_handlers import is_open


@pytest.mark.tier1
Expand Down Expand Up @@ -150,6 +152,37 @@ def test_positive_provision_end_to_end(
!= 'Pending installation',
timeout=1800,
delay=30,
silent_failure=True,
handle_exception=True,
)
vcenter8_issue = provision_method == 'bootdisk' and vmware == '8' and is_open('BZ:2255264')
host_info = sat.cli.Host.info({'id': host['id']})
assert host_info['status']['build-status'] == 'Installed'
assert (
host_info['status']['build-status'] == 'Pending installation'
if vcenter8_issue
else 'Installed'
)

# Perform OS version check and check if root password is properly updated
provisioning_host = ContentHost(host_info['network-interfaces'][0]['ipv4-address'])
expected_rhel_version = host_info['operating-system']['operating-system'][-3:]

# Wait for the host to be rebooted and SSH daemon to be started.
provisioning_host.wait_for_connection()

if int(expected_rhel_version.split('.')[0]) >= 9:
assert (
provisioning_host.execute(
'echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config; systemctl restart sshd'
).status
== 0
)
host_ssh_os = sat.execute(
f'sshpass -p {settings.provisioning.host_root_password} '
'ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no -o PasswordAuthentication=yes '
f'-o UserKnownHostsFile=/dev/null root@{provisioning_host.hostname} cat /etc/redhat-release'
)
assert host_ssh_os.status == 0
assert (
expected_rhel_version in host_ssh_os.stdout
), f'The installed OS version differs from the expected version {expected_rhel_version}'

0 comments on commit eeab424

Please sign in to comment.