swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f08a70dd0f0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f08a70ddeb8>
datadir = '/var/lib/jenkins/workspace/DLS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/lister/fedora/tests/data'
def test_full_lister_fedora(
swh_scheduler: SchedulerInterface,
mocker: MagicMock,
datadir: Path,
):
"""
Simulates a full listing of packages for fedora releases.
"""
releases = [26, 36]
lister = FedoraLister(
scheduler=swh_scheduler,
releases=releases,
)
get_editions_patch = mocker.patch("swh.lister.fedora.lister.get_editions")
get_editions_patch.return_value = ["Everything"]
pkg_versions = _pkg_versions.copy()
mock_repomd(datadir, mocker)
> run_lister(lister, swh_scheduler, releases, pkg_versions, origin_count=3)
.tox/py3/lib/python3.7/site-packages/swh/lister/fedora/tests/test_lister.py:128:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lister = <swh.lister.fedora.lister.FedoraLister object at 0x7f08aed946d8>
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f08a70dd0f0>
releases = [26, 36]
pkg_versions = {'rpm://fedora/packages/0install': {'26/Everything/2.11': {'buildTime': '2017-02-10T10:29:31', 'edition': 'Everything'...Everything/4.5.1': {'buildTime': '2022-01-20T00:42:21', 'edition': 'Everything', 'name': '2ping', 'release': 36, ...}}}
origin_count = 3
def run_lister(
lister: FedoraLister,
swh_scheduler: SchedulerInterface,
releases: List[Release],
pkg_versions: dict,
origin_count: int,
):
"""Runs the lister and tests that the listed origins are correct."""
stats = lister.run()
scheduler_origins = swh_scheduler.get_listed_origins(lister.lister_obj.id).results
lister_state = lister.get_state_from_scheduler()
state_pkg_versions = {k.split("/")[-1]: set(v) for k, v in pkg_versions.items()}
# One edition from each release (we mocked get_editions)
assert stats.pages == len(releases)
assert stats.origins == origin_count
> assert {
o.url: o.extra_loader_arguments["packages"] for o in scheduler_origins
} == pkg_versions
E AssertionError: assert {'rpm://fedor...e': 36, ...}}} == {'rpm://fedor...e': 36, ...}}}
E Differing items:
E {'rpm://fedora/packages/2ping': {'36/Everything/4.5.1': {'buildTime': '2022-01-19T19:12:21', 'edition': 'Everything', 'name': '2ping', 'release': 36, ...}}} != {'rpm://fedora/packages/2ping': {'36/Everything/4.5.1': {'buildTime': '2022-01-20T00:42:21', 'edition': 'Everything', 'name': '2ping', 'release': 36, ...}}}
E {'rpm://fedora/packages/0install': {'26/Everything/2.11': {'buildTime': '2017-02-10T04:59:31', 'edition': 'Everything', 'name': '0install', 'release': 26, ...}}} != {'rpm://fedora/packages/0install': {'26/Everything/2.11': {'buildTime': '2017-0...
E
E ...Full output truncated (41 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/lister/fedora/tests/test_lister.py:94: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 6 2022, 8:13 AM