Skip to content

Commit

Permalink
[6.13.z] Ensure correct finalizer order (#14747)
Browse files Browse the repository at this point in the history
Ensure correct finalizer order (#14620)

the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
(cherry picked from commit 8eea8dc)

Co-authored-by: dosas <[email protected]>
  • Loading branch information
Satellite-QE and dosas authored Apr 11, 2024
1 parent e62a968 commit 4a2b2a7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/foreman/api/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def test_positive_parameter_precedence_impact(
:steps:
1. Create Global Parameter
2. Create host and verify global parameter is assigned
3. Create Host Group with parameter
2. Create Host Group with parameter
3. Create host and verify global parameter is assigned
4. Assign hostgroup to host created above and verify hostgroup parameter is assigned.
5. Add parameter on the host directly, and verify that this should take precedence
over Host group and Global Parameter
Expand All @@ -40,18 +40,21 @@ def test_positive_parameter_precedence_impact(

cp = module_target_sat.api.CommonParameter(name=param_name, value=param_value).create()
request.addfinalizer(cp.delete)
host = module_target_sat.api.Host(organization=module_org, location=module_location).create()
request.addfinalizer(host.delete)
result = [res for res in host.all_parameters if res['name'] == param_name]
assert result[0]['name'] == param_name
assert result[0]['associated_type'] == 'global'

hg = module_target_sat.api.HostGroup(
organization=[module_org],
group_parameters_attributes=[{'name': param_name, 'value': param_value}],
).create()
request.addfinalizer(hg.delete)

host = module_target_sat.api.Host(organization=module_org, location=module_location).create()
request.addfinalizer(host.delete)
result = [res for res in host.all_parameters if res['name'] == param_name]
assert result[0]['name'] == param_name
assert result[0]['associated_type'] == 'global'

host.hostgroup = hg

host = host.update(['hostgroup'])
result = [res for res in host.all_parameters if res['name'] == param_name]
assert result[0]['name'] == param_name
Expand Down

0 comments on commit 4a2b2a7

Please sign in to comment.