replayer_storage_and_client = (<swh.storage.in_memory.InMemoryStorage object at 0x7f23503ca1d0>, <swh.journal.client.JournalClient object at 0x7f23503ca780>)
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f235155e160>
def test_storage_play_with_collision(replayer_storage_and_client, caplog):
"""Another replayer scenario with collisions.
This:
- writes objects to the topic, including colliding contents
- replayer consumes objects from the topic and replay them
- This drops the colliding contents from the replay when detected
"""
src, replayer = replayer_storage_and_client
# Fill Kafka using a source storage
nb_sent = 0
for object_type, objects in TEST_OBJECTS.items():
method = getattr(src, object_type + "_add")
method(objects)
if object_type == "origin_visit":
nb_sent += len(objects) # origin-visit-add adds origin-visit-status as well
nb_sent += len(objects)
# Create collision in input data
# These should not be written in the destination
producer = src.journal_writer.journal.producer
prefix = src.journal_writer.journal._prefix
for content in DUPLICATE_CONTENTS:
topic = f"{prefix}.content"
> key = content.sha1
E AttributeError: 'dict' object has no attribute 'sha1'
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_replay.py:122: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Jul 31 2020, 10:20 AM