swh_search = <swh.search.elasticsearch.ElasticSearch object at 0x7f969175ebe0>
elasticsearch_host = '127.0.0.1:42967', kafka_prefix = 'ohmpavtyjz'
kafka_server = '127.0.0.1:45115'
def test__journal_client__origin(
swh_search, elasticsearch_host: str, kafka_prefix: str, kafka_server
):
"""Tests the re-indexing when origin_batch_size*task_batch_size is a
divisor of nb_origins."""
producer = Producer(
{
"bootstrap.servers": kafka_server,
"client.id": "test search origin producer",
"acks": "all",
}
)
value = value_to_kafka({"url": "http://foobar.baz",})
topic = f"{kafka_prefix}.origin"
producer.produce(topic=topic, key=b"bogus-origin", value=value)
journal_objects_config = JOURNAL_OBJECTS_CONFIG_TEMPLATE.format(
broker=kafka_server, prefix=kafka_prefix, group_id="test-consumer"
)
result = invoke(
False,
["journal-client", "objects", "--stop-after-objects", "1",],
journal_objects_config,
elasticsearch_host=elasticsearch_host,
)
# Check the output
expected_output = "Processed 1 messages.\nDone.\n"
assert result.exit_code == 0, result.output
assert result.output == expected_output
swh_search.flush()
# It's an origin with no visit, searching for it with visit
results = swh_search.origin_search(url_pattern="foobar", with_visit=True)
# returns nothing
> assert results == {"next_page_token": None, "results": []}
E AssertionError: assert {'next_page_t...foobar.baz'}]} == {'next_page_t...'results': []}
E Omitting 1 identical items, use -vv to show
E Differing items:
E {'results': [{'url': 'http://foobar.baz'}]} != {'results': []}
E Full diff:
E - {'next_page_token': None, 'results': []}
E + {'next_page_token': None, 'results': [{'url': 'http://foobar.baz'}]}
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_cli.py:91: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 13 2020, 2:44 PM