Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/tests/test_client.py
Show First 20 Lines • Show All 362 Lines • ▼ Show 20 Lines | client = JournalClient( | ||||
brokers=[kafka_server], | brokers=[kafka_server], | ||||
group_id=kafka_consumer_group, | group_id=kafka_consumer_group, | ||||
prefix=kafka_prefix, | prefix=kafka_prefix, | ||||
stop_after_objects=1, | stop_after_objects=1, | ||||
value_deserializer=custom_deserializer, | value_deserializer=custom_deserializer, | ||||
) | ) | ||||
worker_fn = MagicMock() | worker_fn = MagicMock() | ||||
client.process(worker_fn) | client.process(worker_fn) | ||||
# check that the first Revision has not been passed to worker_fn | |||||
# a commit seems to be needed to prevent some race condition situation | |||||
# where the worker_fn has not yet been called at this point (not sure how) | |||||
client.consumer.commit() | |||||
# Check the first revision has not been passed to worker_fn | |||||
worker_fn.assert_called_once_with({"revision": revisions[1:]}) | worker_fn.assert_called_once_with({"revision": revisions[1:]}) |