storage = <swh.storage.in_memory.InMemoryStorage object at 0x7f1d08eba828>
indexer_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f1d08de0c88>
kafka_prefix = 'cnujhmnpib', kafka_server = '127.0.0.1:37811'
consumer = <cimpl.Consumer object at 0x7f1d0c283158>
def test_journal_client(
storage, indexer_scheduler, kafka_prefix: str, kafka_server, consumer: Consumer
):
"""Test the 'swh indexer journal-client' cli tool."""
producer = Producer(
{
"bootstrap.servers": kafka_server,
"client.id": "test producer",
"acks": "all",
}
)
STATUS = {"status": "full", "origin": {"url": "file://dev/0000",}}
producer.produce(
topic=kafka_prefix + ".origin_visit",
key=b"bogus",
value=value_to_kafka(STATUS),
)
result = invoke(
indexer_scheduler,
False,
[
"journal-client",
"--stop-after-objects",
"1",
"--broker",
kafka_server,
"--prefix",
kafka_prefix,
"--group-id",
> "test-consumer",
],
)
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_cli.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_cli.py:85: in invoke
"swh.indexer.cli.get_scheduler"
/usr/lib/python3.7/unittest/mock.py:1268: in __enter__
original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.mock._patch object at 0x7f1d08de0b70>
def get_original(self):
target = self.getter()
name = self.attribute
original = DEFAULT
local = False
try:
original = target.__dict__[name]
except (AttributeError, KeyError):
original = getattr(target, name, DEFAULT)
else:
local = True
if name in _builtins and isinstance(target, ModuleType):
self.create = True
if not self.create and original is DEFAULT:
raise AttributeError(
> "%s does not have the attribute %r" % (target, name)
)
E AttributeError: <module 'swh.indexer.cli' from '/var/lib/jenkins/workspace/DCIDX/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/indexer/cli.py'> does not have the attribute 'get_scheduler'
/usr/lib/python3.7/unittest/mock.py:1242: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Sep 10 2020, 4:16 PM