cli_runner = <click.testing.CliRunner object at 0x7f7cf933dcf8>
swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_cli_journal_client_schedu0/indexer.yml'
indexer_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f7cf93306a0>
kafka_prefix = 'ctmjaizsdr', kafka_server = '127.0.0.1:38153'
consumer = <cimpl.Consumer object at 0x7f7cf93394a8>
def test_cli_journal_client_schedule(
cli_runner,
swh_config,
indexer_scheduler,
kafka_prefix: str,
kafka_server,
consumer: Consumer,
):
"""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
)
visit_statuses = [
OriginVisitStatus(
origin="file:///dev/zero",
visit=1,
date=now(),
status="full",
snapshot=None,
),
OriginVisitStatus(
origin="file:///dev/foobar",
visit=2,
date=now(),
status="full",
snapshot=None,
),
OriginVisitStatus(
origin="file:///tmp/spamegg",
visit=3,
date=now(),
status="full",
snapshot=None,
),
OriginVisitStatus(
origin="file:///dev/0002",
visit=6,
date=now(),
status="full",
snapshot=None,
),
OriginVisitStatus( # will be filtered out due to its 'partial' status
origin="file:///dev/0000",
visit=4,
date=now(),
status="partial",
snapshot=None,
),
OriginVisitStatus( # will be filtered out due to its 'ongoing' status
origin="file:///dev/0001",
visit=5,
date=now(),
status="ongoing",
snapshot=None,
),
]
journal_writer.write_additions("origin_visit_status", visit_statuses)
visit_statuses_full = [vs for vs in visit_statuses if vs.status == "full"]
result = cli_runner.invoke(
indexer_cli_group,
[
"-C",
swh_config,
"journal-client",
"--broker",
kafka_server,
"--prefix",
kafka_prefix,
"--group-id",
"test-consumer",
"--stop-after-objects",
len(visit_statuses),
"--origin-metadata-task-type",
"index-origin-metadata",
],
catch_exceptions=False,
)
# Check the output
expected_output = "Done.\n"
> assert result.exit_code == 0, result.output
E AssertionError: Error: Unknown indexer: None
E
E assert 1 == 0
E + where 1 = <Result SystemExit(1)>.exit_code
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_cli.py:496: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 20 2022, 7:31 PM