swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7fd047857128>
requests_mock = <requests_mock.mocker.Mocker object at 0x7fd046640b00>
http_code = 502
@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('85aa0ce9-86b7-4147-bc9b-cf367206adba'), 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, 34, 845075, tzinfo=datetime.timezone.utc), last_seen=datetime.datetime(2022, 5, 23, 9, 57, 34, 845075, tzinfo=datetime.timezone.utc)), ListedOrigin(lister_id=UUID('85aa0ce9-86b7-4147-bc9b-cf367206adba'), 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, 34, 836648, tzinfo=datetime.timezone.utc), last_seen=datetime.datetime(2022, 5, 23, 9, 57, 34, 838161, 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