Skip to content

Commit a6afd05

Browse files
authored
errata sync status for default org view and content view (#22196)
rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent 72eb866 commit a6afd05

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

tests/foreman/ui/test_errata.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,3 +1703,104 @@ def test_content_host_errata_search_commands(
17031703
assert row['Errata'] == settings.repos.yum_6.errata[0]
17041704
assert row['Type'] == 'Bugfix'
17051705
assert row['Synopsis'] == 'Kangaroo_Erratum'
1706+
1707+
1708+
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
1709+
def test_positive_repo_sync_status_on_errata_repository(
1710+
module_sca_manifest_org,
1711+
module_product,
1712+
module_target_sat,
1713+
module_cv,
1714+
):
1715+
"""Verify that errata repository sync status is displayed correctly
1716+
when viewing errata through a Content View, not just the Default
1717+
Organization View.
1718+
1719+
:id: 8e0ea736-b80a-4aa1-801d-980db2519501
1720+
1721+
:setup:
1722+
1. Organization with a manifest.
1723+
2. Product with a custom repository containing errata, synced.
1724+
3. Content View with the repository, published.
1725+
1726+
:steps:
1727+
1. Navigate to Content > Errata, select an erratum.
1728+
2. On the Repositories tab, verify the Last Sync value shows a
1729+
successful sync timestamp with Default Organization View.
1730+
3. Change the Content View filter to the published Content View.
1731+
4. Verify the Last Sync value still shows a successful sync
1732+
timestamp.
1733+
1734+
:expectedresults: The repository sync status on the errata Repositories
1735+
tab shows a successful sync timestamp (e.g. "Success less than a
1736+
minute ago") for both the Default Organization View and the
1737+
published Content View.
1738+
1739+
:Verifies: SAT-45979
1740+
1741+
:customerscenario: true
1742+
"""
1743+
custom_repo = module_target_sat.api.Repository(
1744+
url=CUSTOM_REPO_URL,
1745+
product=module_product,
1746+
).create()
1747+
custom_repo.sync()
1748+
custom_repo = custom_repo.read()
1749+
assert custom_repo.last_sync, 'Repository sync task was not recorded.'
1750+
module_cv.repository = [custom_repo]
1751+
module_cv.update(['repository'])
1752+
module_cv.publish()
1753+
module_cv = module_cv.read()
1754+
1755+
with module_target_sat.ui_session() as session:
1756+
session.organization.select(org_name=module_sca_manifest_org.name)
1757+
session.location.select(loc_name=DEFAULT_LOC)
1758+
1759+
# Read errata details with default content view filter
1760+
errata = session.errata.read(CUSTOM_REPO_ERRATA_ID, applicable=False)
1761+
repos_table = errata['repositories']['table']
1762+
assert repos_table, (
1763+
f'No repositories found for errata {CUSTOM_REPO_ERRATA_ID}'
1764+
f' in org {module_sca_manifest_org.name}.'
1765+
)
1766+
available_repo = next(
1767+
(r for r in repos_table if r['Name'] == custom_repo.name),
1768+
None,
1769+
)
1770+
assert available_repo, (
1771+
f'Repository {custom_repo.name} not found in errata repositories table.'
1772+
)
1773+
repo_sync_status = available_repo.get('Last Sync')
1774+
assert repo_sync_status, (
1775+
'Last Sync column is empty for the repository with default content view filter.'
1776+
)
1777+
assert all(x in repo_sync_status for x in ('Success', 'ago')), (
1778+
f'Expected a successful sync timestamp (e.g. "Success less than a minute ago") '
1779+
f'with default content view filter, but got: {repo_sync_status}'
1780+
)
1781+
1782+
# Search errata repositories filtered by Content View
1783+
cv_repos_table = session.errata.search_repositories(
1784+
CUSTOM_REPO_ERRATA_ID, custom_repo.name, cv=module_cv.name
1785+
)
1786+
assert cv_repos_table, (
1787+
f'No repositories found for errata {CUSTOM_REPO_ERRATA_ID}'
1788+
f' when filtered by Content View {module_cv.name}.'
1789+
)
1790+
cv_repo = next(
1791+
(r for r in cv_repos_table if r['Name'] == custom_repo.name),
1792+
None,
1793+
)
1794+
assert cv_repo, (
1795+
f'Repository {custom_repo.name} not found in errata repositories table'
1796+
f' when filtered by Content View {module_cv.name}.'
1797+
)
1798+
cv_sync_status = cv_repo.get('Last Sync')
1799+
assert cv_sync_status, (
1800+
f'Last Sync column is empty for the repository when filtered by'
1801+
f' Content View {module_cv.name}.'
1802+
)
1803+
assert all(x in cv_sync_status for x in ('Success', 'ago')), (
1804+
f'Expected a successful sync timestamp (e.g. "Success less than a minute ago") '
1805+
f'when filtered by Content View {module_cv.name}, but got: {cv_sync_status}'
1806+
)

0 commit comments

Comments
 (0)