cli_runner = <click.testing.CliRunner object at 0x7f9e156e1a58>
swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_cli_journal_client_index_3/indexer.yml'
kafka_prefix = 'celhqcaodc', kafka_server = '127.0.0.1:42517'
consumer = <cimpl.Consumer object at 0x7f9e285aba48>
idx_storage = <swh.indexer.storage.IndexerStorage object at 0x7f9e156e14e0>
storage = <swh.storage.postgresql.storage.Storage object at 0x7f9e299d3f28>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f9e240aa710>
swh_indexer_config = {'compute_checksums': ['blake2b512'], 'indexer_storage': {'cls': 'local', 'db': "user=postgres password=xxx dbname=tes...cheduler': {'cls': 'local', 'db': "user=postgres password=xxx dbname=tests host=127.0.0.1 port=25684 options=''"}, ...}
indexer_name = '*'
@pytest.mark.parametrize("indexer_name", ["extrinsic_metadata", "*"])
def test_cli_journal_client_index__origin_extrinsic_metadata(
cli_runner,
swh_config,
kafka_prefix: str,
kafka_server,
consumer: Consumer,
idx_storage,
storage,
mocker,
swh_indexer_config,
indexer_name: str,
):
"""Test the 'swh indexer journal-client' cli tool."""
journal_writer = get_journal_writer(
"kafka",
brokers=[kafka_server],
prefix=kafka_prefix,
client_id="test producer",
value_sanitizer=lambda object_type, value: value,
flush_timeout=3, # fail early if something is going wrong
)
origin = Origin("http://example.org/repo.git")
storage.origin_add([origin])
raw_extrinsic_metadata = attr.evolve(REMD, target=origin.swhid())
raw_extrinsic_metadata = attr.evolve(
raw_extrinsic_metadata, id=raw_extrinsic_metadata.compute_hash()
)
journal_writer.write_additions("raw_extrinsic_metadata", [raw_extrinsic_metadata])
result = cli_runner.invoke(
indexer_cli_group,
[
"-C",
swh_config,
"journal-client",
indexer_name,
"--broker",
kafka_server,
"--prefix",
kafka_prefix,
"--group-id",
"test-consumer",
"--stop-after-objects",
1,
],
> catch_exceptions=False,
)
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_cli.py:736:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/click/testing.py:408: in invoke
return_value = cli.main(args=args or (), prog_name=prog_name, **extra)
.tox/py3/lib/python3.7/site-packages/click/core.py:1055: in main
rv = self.invoke(ctx)
.tox/py3/lib/python3.7/site-packages/click/core.py:1657: in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
.tox/py3/lib/python3.7/site-packages/click/core.py:1404: in invoke
return ctx.invoke(self.callback, **ctx.params)
.tox/py3/lib/python3.7/site-packages/click/core.py:760: in invoke
return __callback(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/click/decorators.py:26: in new_func
return f(get_current_context(), *args, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/indexer/cli.py:376: in journal_client
client.process(worker_fn)
.tox/py3/lib/python3.7/site-packages/swh/journal/client.py:318: in process
batch_processed, at_eof = self.handle_messages(messages, worker_fn)
.tox/py3/lib/python3.7/site-packages/swh/journal/client.py:356: in handle_messages
worker_fn(dict(objects))
.tox/py3/lib/python3.7/site-packages/swh/indexer/cli.py:373: in worker_fn
fn(objects)
.tox/py3/lib/python3.7/site-packages/swh/indexer/metadata.py:85: in process_journal_objects
results[remd.target] = self.index(remd.id, data=remd)
.tox/py3/lib/python3.7/site-packages/swh/indexer/metadata.py:127: in index
metadata_item = mapping.translate(data.metadata)
.tox/py3/lib/python3.7/site-packages/swh/indexer/metadata_dictionary/base.py:359: in translate
return self._translate_dict(content_dict)
.tox/py3/lib/python3.7/site-packages/swh/indexer/metadata_dictionary/base.py:221: in _translate_dict
root = self.get_root_uri(content_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.indexer.metadata_dictionary.github.GitHubMapping object at 0x7f9e28714dd8>
content_dict = {'full_name': 'test software'}
def get_root_uri(self, content_dict: dict) -> URIRef:
if isinstance(content_dict.get("html_url"), str):
return URIRef(content_dict["html_url"])
else:
> raise ValueError(f"Unexpected html_url in GitHub metadata: {content_dict}")
E ValueError: Unexpected html_url in GitHub metadata: {'full_name': 'test software'}
.tox/py3/lib/python3.7/site-packages/swh/indexer/metadata_dictionary/github.py:53: ValueError
TEST RESULT
TEST RESULT
- Run At
- Sep 15 2022, 9:00 AM