Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.14.z] variable value should del after update #17131

Open
wants to merge 1 commit into
base: 6.14.z
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions tests/foreman/ui/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,28 @@ def test_positive_assign_ansible_role_variable_on_host(
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. Override the variable value.
6. Reset the overridden value to the original 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 Down Expand Up @@ -229,6 +236,30 @@ def _finalize():
(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"]'
# Update the value in a variable.
session.host_new.update_variable_value(rhel_contenthost.hostname, new_key, new_value)
update_value = session.host_new.read_variable_value(rhel_contenthost.hostname, new_key)
assert new_value in update_value

# Revert the updated value to its default state.
session.host_new.del_variable_value(rhel_contenthost.hostname)
reset_variable_value = session.host_new.read_variable_value(
rhel_contenthost.hostname, new_key
)
assert new_value not in reset_variable_value
assert default_value in reset_variable_value

@pytest.mark.tier3
@pytest.mark.parametrize('setting_update', ['ansible_roles_to_ignore'], indirect=True)
def test_positive_ansible_roles_ignore_list(self, target_sat, setting_update):
Expand Down
Loading