objstorages = {'dst': <swh.objstorage.backends.in_memory.InMemoryObjStorage object at 0x7f90a4a183c8>, 'src': <swh.objstorage.backends.in_memory.InMemoryObjStorage object at 0x7f90a4a18320>}
kafka_prefix = 'dpfezgismq', kafka_consumer_group = 'test-consumer-dpfezgismq'
kafka_server = '127.0.0.1:50245', check_dst = False, expected_copied = 10
expected_in_dst = 0
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f909bf8a4e0>
@_patch_objstorages(["src", "dst"])
@pytest.mark.parametrize(
"check_dst,expected_copied,expected_in_dst",
[
(True, NUM_CONTENTS - NUM_CONTENTS_DST, NUM_CONTENTS_DST),
(False, NUM_CONTENTS, 0),
],
)
def test_replay_content_check_dst(
objstorages,
kafka_prefix: str,
kafka_consumer_group: str,
kafka_server: Tuple[Popen, int],
check_dst: bool,
expected_copied: int,
expected_in_dst: int,
caplog,
):
"""Check the content replayer in normal conditions
with some objects already in the dst objstorage.
When check_dst is True, expect those not to be neither retrieved from the
src objstorage nor pushed in the dst objstorage.
"""
contents = _fill_objstorage_and_kafka(
kafka_server, kafka_prefix, objstorages["src"]
)
# add some objects in the dst objstorage
for i, (sha1, content) in enumerate(contents.items()):
if i >= NUM_CONTENTS_DST:
break
objstorages["dst"].add(content, obj_id=sha1)
caplog.set_level(logging.DEBUG, "swh.objstorage.replayer.replay")
result = invoke(
"replay",
"--stop-after-objects",
str(NUM_CONTENTS),
"--check-dst" if check_dst else "--no-check-dst",
journal_config={
"brokers": kafka_server,
"group_id": kafka_consumer_group,
"prefix": kafka_prefix,
},
)
expected = r"Done.\n"
> assert result.exit_code == 0, result.output
E AssertionError:
E assert 1 == 0
E +1
E -0
.tox/py3/lib/python3.7/site-packages/swh/objstorage/replayer/tests/test_cli.py:347: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Dec 9 2021, 4:58 PM