swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7fd0466c64e0>
requests_mock = <requests_mock.mocker.Mocker object at 0x7fd046782ba8>
http_code = 400
@pytest.mark.parametrize("http_code", [400, 404, 500, 502])
def test_maven_list_http_error_artifacts(
swh_scheduler,
requests_mock,
http_code,
):
"""should continue listing when failing to retrieve artifacts."""
# Test failure of artefacts retrieval.
requests_mock.get(URL_POM_1, status_code=http_code)
lister = MavenLister(scheduler=swh_scheduler, url=MVN_URL, index_url=INDEX_URL)
# on artifacts though, that raises but continue listing
lister.run()
# If the maven_index_full step succeeded but not the get_pom step,
# then we get only one maven-jar origin and one git origin.
scheduler_origins = swh_scheduler.get_listed_origins(lister.lister_obj.id).results
> assert len(scheduler_origins) == 3
E AssertionError: assert 2 == 3
E + where 2 = len([ListedOrigin(lister_id=UUID('da68f22d-eb29-457e-8ee7-e590020c1ce1'), url='https://github.com/ArangoDB-Community/arangodb-graphql-java', visit_type='git', extra_loader_arguments={}, last_update=None, enabled=True, first_seen=datetime.datetime(2022, 5, 23, 9, 57, 33, 509422, tzinfo=datetime.timezone.utc), last_seen=datetime.datetime(2022, 5, 23, 9, 57, 33, 509422, tzinfo=datetime.timezone.utc)), ListedOrigin(lister_id=UUID('da68f22d-eb29-457e-8ee7-e590020c1ce1'), url='https://repo1.maven.org/maven2/al/aldi/sprova4j', visit_type='maven', extra_loader_arguments={'artifacts': [{'aid': 'sprova4j', 'gid': 'al.aldi', 'url': 'https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.0/sprova4j-0.1.0-sources.jar', 'time': '2021-07-12T17:06:59+00:00', 'type': 'maven', 'version': '0.1.0', 'base_url': 'https://repo1.maven.org/maven2/'}, {'aid': 'sprova4j', 'gid': 'al.aldi', 'url': 'https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.1/sprova4j-0.1.1-sources.jar', 'time': '2021-07-12T17:37:05+00:00', 'type': 'maven', 'version': '0.1.1', 'base_url': 'https://repo1.maven.org/maven2/'}]}, last_update=datetime.datetime(2021, 7, 12, 17, 37, 5, tzinfo=datetime.timezone.utc), enabled=True, first_seen=datetime.datetime(2022, 5, 23, 9, 57, 33, 500503, tzinfo=datetime.timezone.utc), last_seen=datetime.datetime(2022, 5, 23, 9, 57, 33, 502122, tzinfo=datetime.timezone.utc))])
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/tests/test_lister.py:316: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 23 2022, 11:58 AM