swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f966fea1e10>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f966fea19e8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f966fea1400>
maven_index = 'doc 0\n field 0\n name u\n type string\n value al.aldi|sprova4j|0.1.0|sources|jar\n field 1\n name m\n ...e rootGroups\n field 19\n name rootGroupsList\n type string\n value al\nEND\nchecksum 00000000003321211082\n'
maven_index_incr = 'doc 0\n field 0\n name u\n type string\n value al.aldi|sprova4j|0.1.0|sources|jar\n field 1\n name m\n ...otGroups\n field 19\n name rootGroupsList\n type string\n value com|al\nEND\nchecksum 00000000004102281591\n'
maven_index_incr_3 = 'doc 0\n field 0\n name u\n type string\n value al.aldi|sprova4j|0.1.1|sources|jar\n field 1\n name m\n ...otGroups\n field 20\n name rootGroupsList\n type string\n value com|al\nEND\nchecksum 00000000002844832287\n'
maven_pom_1 = '<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.a...actId>\n <version>3.10.0</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>\n'
maven_pom_2 = '<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.a...actId>\n <version>3.10.0</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>\n'
maven_pom_3 = '<?xml version="1.0" encoding="UTF-8"?>\n<!--\n ~ DISCLAIMER\n ~ Copyright 2019 ArangoDB GmbH, Cologne, Germany\n ~...n>\n <name>ArangoDB GmbH</name>\n <url>https://www.arangodb.com</url>\n </organization>\n\n</project>'
maven_pom_4 = '<?xml version="1.0" encoding="UTF-8"?>\n<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.o...guicier.git</developerConnection>\n <url>https://github.com/jolira/wicket-guicier\n </url>\n </scm>\n</project>'
def test_maven_incremental_listing_3(
swh_scheduler,
requests_mock,
mocker,
maven_index,
maven_index_incr,
maven_index_incr_3,
maven_pom_1,
maven_pom_2,
maven_pom_3,
maven_pom_4,
):
"""Covers full listing of multiple pages, checking page results and listed
origins, with a second updated run for statefulness, and a third updated run
with deleted artefacts and a parent pom (i.e. without groupId)."""
lister = MavenLister(
scheduler=swh_scheduler,
url=MVN_URL,
instance="maven.org",
index_url=INDEX_URL,
incremental=True,
)
# Set up test.
requests_mock.get(INDEX_URL, text=maven_index)
requests_mock.get(URL_POM_1, text=maven_pom_1)
requests_mock.get(URL_POM_2, text=maven_pom_2)
# Then run the lister.
stats = lister.run()
# Start test checks.
assert lister.incremental
assert lister.updated
assert stats.pages == 4
assert stats.origins == 4
# Second execution of the lister, incremental mode
lister = MavenLister(
scheduler=swh_scheduler,
url=MVN_URL,
instance="maven.org",
index_url=INDEX_URL,
incremental=True,
)
scheduler_state = lister.get_state_from_scheduler()
assert scheduler_state is not None
assert scheduler_state.last_seen_doc == 3
# Set up test.
requests_mock.get(INDEX_URL, text=maven_index_incr)
requests_mock.get(URL_POM_3, text=maven_pom_3)
# Then run the lister.
stats = lister.run()
# Start test checks.
assert lister.incremental
assert lister.updated
assert stats.pages == 1
assert stats.origins == 1
scheduler_origins = swh_scheduler.get_listed_origins(lister.lister_obj.id).results
origin_urls = [origin.url for origin in scheduler_origins]
assert sorted(origin_urls) == sorted(LIST_SRC + LIST_GIT + LIST_GIT_INCR)
for origin in scheduler_origins:
if origin.visit_type == "maven":
for src in LIST_SRC_DATA:
if src.get("url") == origin.url:
artifact = origin.extra_loader_arguments["artifacts"][0]
> assert src.get("time") == artifact["time"]
E AssertionError: assert '2021-07-12 1....335000+00:00' == '2021-07-12 1....335000+00:00'
E - 2021-07-12 17:06:59.335000+00:00
E ? ^
E + 2021-07-12 19:06:59.335000+00:00
E ? ^
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/tests/test_lister.py:310: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 26 2021, 5:41 PM