Skip to content

Commit 6e909f9

Browse files
authored
Fix failing errata ui tests (#20840)
* fix failing errata tests * add subscription-manager repo command to fix failing test * remove no containers mark * remove no_containers from test_positive_errata_search_type
1 parent 427f1f9 commit 6e909f9

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

tests/foreman/ui/test_errata.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,7 @@ def test_positive_check_errata(session, registered_contenthost):
11351135
vm = registered_contenthost
11361136
hostname = vm.hostname
11371137
assert vm.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0
1138+
assert vm.execute('subscription-manager repos').status == 0
11381139
with session:
11391140
session.location.select(loc_name=DEFAULT_LOC)
11401141
read_errata = session.host_new.get_details(hostname, 'Content.Errata')
@@ -1204,7 +1205,9 @@ def test_positive_host_content_library(
12041205
[[CUSTOM_REPO_URL]],
12051206
indirect=True,
12061207
)
1207-
def test_positive_errata_search_type(session, module_sca_manifest_org, registered_contenthost):
1208+
def test_positive_errata_search_type(
1209+
session, module_target_sat, module_sca_manifest_org, registered_contenthost
1210+
):
12081211
"""Search for errata on a host's page content-errata tab by type.
12091212
12101213
:id: f278f0e8-3b64-4dbf-a0c8-b9b289474a76
@@ -1219,8 +1222,25 @@ def test_positive_errata_search_type(session, module_sca_manifest_org, registere
12191222
:BZ: 1653293
12201223
"""
12211224
vm = registered_contenthost
1225+
hostname = vm.hostname
12221226
pkgs = ' '.join(FAKE_9_YUM_OUTDATED_PACKAGES)
1227+
install_timestamp = (datetime.now(UTC).replace(microsecond=0) - timedelta(seconds=1)).strftime(
1228+
TIMESTAMP_FMT
1229+
)
12231230
assert vm.execute(f'yum install -y {pkgs}').status == 0
1231+
assert vm.execute('subscription-manager repos').status == 0
1232+
applicability_tasks = module_target_sat.wait_for_tasks(
1233+
search_query=(
1234+
f'Bulk generate applicability for host {hostname}'
1235+
f' and started_at >= "{install_timestamp}"'
1236+
),
1237+
search_rate=2,
1238+
max_tries=60,
1239+
)
1240+
assert len(applicability_tasks) > 0, (
1241+
'No Errata applicability task(s) found after successful yum install.'
1242+
f' Expected at least one task for registered host: {hostname}'
1243+
)
12241244

12251245
with session:
12261246
session.location.select(loc_name=DEFAULT_LOC)
@@ -1389,8 +1409,11 @@ def test_positive_check_errata_counts_by_type_on_host_details_page(
13891409
assert int(len(read_errata['Content']['Errata']['pagination'])) == 0
13901410

13911411
pkgs = ' '.join(FAKE_9_YUM_OUTDATED_PACKAGES)
1392-
install_timestamp = datetime.now(UTC).replace(microsecond=0) - timedelta(seconds=1)
1412+
install_timestamp = (
1413+
datetime.now(UTC).replace(microsecond=0) - timedelta(seconds=1)
1414+
).strftime(TIMESTAMP_FMT)
13931415
assert vm.execute(f'yum install -y {pkgs}').status == 0
1416+
assert vm.execute('subscription-manager repos').status == 0
13941417

13951418
# applicability task(s) found and succeed
13961419
applicability_tasks = module_target_sat.wait_for_tasks(
@@ -1508,7 +1531,23 @@ def test_positive_filtered_errata_status_installable_param(
15081531
assert expected_values[key] in actual_values[key], 'Expected text not found'
15091532
property_value = 'Yes'
15101533
session.settings.update(f'name = {setting_update.name}', property_value)
1534+
install_timestamp = (
1535+
datetime.now(UTC).replace(microsecond=0) - timedelta(seconds=1)
1536+
).strftime(TIMESTAMP_FMT)
15111537
assert client.execute(f'yum install -y {FAKE_9_YUM_OUTDATED_PACKAGES[1]}').status == 0
1538+
assert client.execute('subscription-manager repos').status == 0
1539+
applicability_tasks = module_target_sat.wait_for_tasks(
1540+
search_query=(
1541+
f'Bulk generate applicability for host {client.hostname}'
1542+
f' and started_at >= "{install_timestamp}"'
1543+
),
1544+
search_rate=2,
1545+
max_tries=60,
1546+
)
1547+
assert len(applicability_tasks) > 0, (
1548+
'No Errata applicability task(s) found after successful yum install.'
1549+
f' Expected at least one task for registered host: {client.hostname}'
1550+
)
15121551
expected_values = {
15131552
'Status': 'Error',
15141553
'Errata': 'Security errata installable',

0 commit comments

Comments
 (0)