Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_cli.py
Show First 20 Lines • Show All 537 Lines • ▼ Show 20 Lines | with pytest.raises(ValueError, match="brokers"): | ||||
"-C", | "-C", | ||||
swh_config, | swh_config, | ||||
"journal-client", | "journal-client", | ||||
], | ], | ||||
catch_exceptions=False, | catch_exceptions=False, | ||||
) | ) | ||||
@pytest.mark.parametrize("indexer_name", ["origin-intrinsic-metadata", "*"]) | @pytest.mark.parametrize("indexer_name", ["origin_intrinsic_metadata", "*"]) | ||||
def test_cli_journal_client_index__origin_intrinsic_metadata( | def test_cli_journal_client_index__origin_intrinsic_metadata( | ||||
cli_runner, | cli_runner, | ||||
swh_config, | swh_config, | ||||
kafka_prefix: str, | kafka_prefix: str, | ||||
kafka_server, | kafka_server, | ||||
consumer: Consumer, | consumer: Consumer, | ||||
idx_storage, | idx_storage, | ||||
storage, | storage, | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | expected_results = [ | ||||
mappings=["cff"], | mappings=["cff"], | ||||
metadata={"foo": "bar"}, | metadata={"foo": "bar"}, | ||||
) | ) | ||||
for status in sorted(visit_statuses_full, key=lambda r: r.origin) | for status in sorted(visit_statuses_full, key=lambda r: r.origin) | ||||
] | ] | ||||
assert sorted(results, key=lambda r: r.id) == expected_results | assert sorted(results, key=lambda r: r.id) == expected_results | ||||
@pytest.mark.parametrize("indexer_name", ["extrinsic-metadata", "*"]) | @pytest.mark.parametrize("indexer_name", ["extrinsic_metadata", "*"]) | ||||
def test_cli_journal_client_index__origin_extrinsic_metadata( | def test_cli_journal_client_index__origin_extrinsic_metadata( | ||||
cli_runner, | cli_runner, | ||||
swh_config, | swh_config, | ||||
kafka_prefix: str, | kafka_prefix: str, | ||||
kafka_server, | kafka_server, | ||||
consumer: Consumer, | consumer: Consumer, | ||||
idx_storage, | idx_storage, | ||||
storage, | storage, | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | ): | ||||
journal_writer.write_additions("content", contents) | journal_writer.write_additions("content", contents) | ||||
result = cli_runner.invoke( | result = cli_runner.invoke( | ||||
indexer_cli_group, | indexer_cli_group, | ||||
[ | [ | ||||
"-C", | "-C", | ||||
swh_config, | swh_config, | ||||
"journal-client", | "journal-client", | ||||
"content-mimetype", | "content_mimetype", | ||||
"--broker", | "--broker", | ||||
kafka_server, | kafka_server, | ||||
"--prefix", | "--prefix", | ||||
kafka_prefix, | kafka_prefix, | ||||
"--group-id", | "--group-id", | ||||
"test-consumer", | "test-consumer", | ||||
"--stop-after-objects", | "--stop-after-objects", | ||||
len(contents), | len(contents), | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | ): | ||||
journal_writer.write_additions("content", contents) | journal_writer.write_additions("content", contents) | ||||
result = cli_runner.invoke( | result = cli_runner.invoke( | ||||
indexer_cli_group, | indexer_cli_group, | ||||
[ | [ | ||||
"-C", | "-C", | ||||
swh_config, | swh_config, | ||||
"journal-client", | "journal-client", | ||||
"content-fossology-license", | "content_fossology_license", | ||||
"--broker", | "--broker", | ||||
kafka_server, | kafka_server, | ||||
"--prefix", | "--prefix", | ||||
kafka_prefix, | kafka_prefix, | ||||
"--group-id", | "--group-id", | ||||
"test-consumer", | "test-consumer", | ||||
"--stop-after-objects", | "--stop-after-objects", | ||||
len(contents), | len(contents), | ||||
Show All 13 Lines |