Skip to content

Commit

Permalink
success > Succeeded status change in host table (#16952)
Browse files Browse the repository at this point in the history
  • Loading branch information
pondrejk authored and amolpati30 committed Nov 20, 2024
1 parent f9eacdc commit e599cc7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 19 deletions.
51 changes: 38 additions & 13 deletions tests/foreman/ui/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,38 @@ def test_positive_host_role_information(self, target_sat, function_host):
all_assigned_roles_table = session.host_new.get_ansible_roles_modal(function_host.name)
assert all_assigned_roles_table[0]['Name'] == SELECTED_ROLE

@pytest.mark.rhel_ver_match('8')
@pytest.mark.no_containers
@pytest.mark.rhel_ver_list([8])
def test_positive_assign_ansible_role_variable_on_host(
self,
request,
target_sat,
rhel_contenthost,
module_activation_key,
module_org,
module_location,
self,
request,
target_sat,
rhel_contenthost,
module_activation_key,
module_org,
module_location,
):
"""Verify ansible variable is added to the role and attached to the host.
"""Verify ansible variable is added to the role and attached to the host and delete updated value in variable
:id: 7ec4fe19-5a08-4b10-bb4e-7327dd68699a
:BZ: 2170727
:Verifies: SAT-23109
:customerscenario: true
:steps:
1. Create an Ansible variable with array type and set the default value.
2. Enable both 'Merge Overrides' and 'Merge Default'.
3. Add the variable to a role and attach the role to the host.
4. Verify that ansible role and variable is added to the host.
5. In variable override the value.
6. Delete the overridden value.
:expectedresults: The role and variable is successfully added to the host.
:expectedresults:
1. The role and variable is successfully added to the host.
2. The overridden value in the variable was successfully deleted, and the default value remains unchanged.
"""

@request.addfinalizer
Expand All @@ -192,8 +199,8 @@ def _finalize():
default_value = '[\"test\"]' # fmt: skip
parameter_type = 'array'
with target_sat.ui_session() as session:
session.organization.select(org_name=module_org.name)
session.location.select(loc_name=module_location.name)
session.organization.select(module_org.name)
session.location.select(module_location.name)
session.ansiblevariables.create_with_overrides(
{
'key': key,
Expand Down Expand Up @@ -228,6 +235,24 @@ def _finalize():
assert (key, SELECTED_ROLE[0], parameter_type, default_value) in [
(v['Name'], v['Ansible role'], v['Type'], v['Value']) for v in variable_table
]
new_key = gen_string('alpha')
session.ansiblevariables.create_with_overrides(
{
'key': new_key,
'ansible_role': SELECTED_ROLE[0],
'override': 'true',
'parameter_type': parameter_type,
'default_value': default_value,
}
)
new_value = '[\"test update\"]'
# Returns the updated value stored in a variable.
update_value = session.host_new.read_update_value(rhel_contenthost.hostname, new_key, new_value)
assert new_value in update_value
#Revert the updated value to its default state.
delete_value = session.host_new.read_delete_value(rhel_contenthost.hostname, new_key)
assert new_value not in delete_value
assert default_value in delete_value

@pytest.mark.tier3
@pytest.mark.parametrize('setting_update', ['ansible_roles_to_ignore'], indirect=True)
Expand Down Expand Up @@ -783,7 +808,7 @@ def test_positive_install_ansible_collection(
status = session.jobinvocation.read(
entity_name=job_description, host_name=client.hostname
)
assert status['overview']['hosts_table'][0]['Status'] == 'success'
assert status['overview']['hosts_table'][0]['Status'] == 'Succeeded'

collection_path = client.execute('ls ~/ansible_collections').stdout
assert 'oasis_roles' in collection_path
Expand Down
2 changes: 1 addition & 1 deletion tests/foreman/ui/test_leapp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ def test_leapp_preupgrade_report(
status = session.jobinvocation.read(
entity_name='Upgradeability check for rhel host', host_name=hostname
)
assert status['overview']['hosts_table'][0]['Status'] == 'success'
assert status['overview']['hosts_table'][0]['Status'] == 'Succeeded'
10 changes: 5 additions & 5 deletions tests/foreman/ui/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_positive_run_default_job_template(
)
session.jobinvocation.wait_job_invocation_state(entity_name='Run ls', host_name=hostname)
status = session.jobinvocation.read(entity_name='Run ls', host_name=hostname)
assert status['overview']['hosts_table'][0]['Status'] == 'success'
assert status['overview']['hosts_table'][0]['Status'] == 'Succeeded'

# check status also on the job dashboard
job_name = f'Run {command}'
Expand Down Expand Up @@ -250,7 +250,7 @@ def test_positive_run_custom_job_template(
entity_name=job_description, host_name=hostname
)
status = session.jobinvocation.read(entity_name=job_description, host_name=hostname)
assert status['overview']['hosts_table'][0]['Status'] == 'success'
assert status['overview']['hosts_table'][0]['Status'] == 'Succeeded'


@pytest.mark.upgrade
Expand Down Expand Up @@ -364,7 +364,7 @@ def test_positive_run_scheduled_job_template_by_ip(session, module_org, rex_cont
assert job_status['overview']['hosts_table'][0]['Status'] in (
'Awaiting start',
'N/A',
'success',
'Succeeded',
)
# recalculate the job left time to be more accurate
job_left_time = (plan_time - session.browser.get_client_datetime()).total_seconds()
Expand All @@ -383,14 +383,14 @@ def test_positive_run_scheduled_job_template_by_ip(session, module_org, rex_cont
lambda: session.jobinvocation.read(
f'Run {command_to_run}', hostname, 'overview.hosts_table'
)['overview']['hosts_table'][0]['Status']
== 'success',
== 'Succeeded',
timeout=30,
delay=1,
)
job_status = session.jobinvocation.read(f'Run {command_to_run}', hostname, 'overview')
assert job_status['overview']['job_status'] == 'Success'
assert job_status['overview']['hosts_table'][0]['Host'] == hostname
assert job_status['overview']['hosts_table'][0]['Status'] == 'success'
assert job_status['overview']['hosts_table'][0]['Status'] == 'Succeeded'


@pytest.mark.tier2
Expand Down

0 comments on commit e599cc7

Please sign in to comment.