swh_scheduler_cfg = {'journal': {'brokers': ['127.0.0.1:40957'], 'group_id': 'test-consume-visit-status'}, 'scheduler': {'cls': 'local', 'db': "dbname=scheduler user=postgres host=127.0.0.1 port=15427 options=''"}}
swh_scheduler_cfg_path = '/tmp/pytest-of-jenkins/pytest-0/test_cli_journal_client_origin2/scheduler.yml'
def test_cli_journal_client_origin_visit_status(
swh_scheduler_cfg, swh_scheduler_cfg_path,
):
kafka_server = swh_scheduler_cfg["journal"]["brokers"][0]
swh_scheduler = get_scheduler(**swh_scheduler_cfg["scheduler"])
producer = Producer(
{
"bootstrap.servers": kafka_server,
"client.id": "test visit-stats producer",
"acks": "all",
}
)
visit_status = VISIT_STATUSES_1[0]
value = value_to_kafka(visit_status)
topic = "swh.journal.objects.origin_visit_status"
producer.produce(topic=topic, key=b"bogus-origin", value=value)
producer.flush()
result = invoke(
["journal-client", "--stop-after-objects", "1",], swh_scheduler_cfg_path,
)
# Check the output
expected_output = "Processed 1 message(s).\nDone.\n"
assert result.exit_code == 0, result.output
assert result.output == expected_output
actual_visit_stats = swh_scheduler.origin_visit_stats_get(
[(visit_status["origin"], visit_status["type"])]
)
> assert actual_visit_stats
E assert []
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_cli_journal.py:114: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 8 2021, 10:32 AM