replayer_storage_and_client = (<swh.storage.in_memory.InMemoryStorage object at 0x7f726dca1da0>, <swh.journal.client.JournalClient object at 0x7f726dca5198>)
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f726c36df60>
def test_storage_replayer(replayer_storage_and_client, caplog):
"""Optimal replayer scenario.
This:
- writes objects to a source storage
- replayer consumes objects from the topic and replays them
- a destination storage is filled from this
In the end, both storages should have the same content.
"""
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)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_replay.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/in_memory.py:803: in origin_visit_add
visit_status = OriginVisitStatus.from_dict(visit_status_dict)
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:73: in from_dict
return cls(**d)
<attrs generated init swh.model.model.OriginVisitStatus>:13: in __init__
__attr_validator_status(self, __attr_status, self.status)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <in_ validator with options ['created', 'ongoing', 'full', 'partial']>
inst = OriginVisitStatus(origin='https://somewhere.org/den/fox', visit=1, date=datetime.datetime(2013, 5, 7, 4, 20, 39, 369271, tzinfo=datetime.timezone.utc), status=None, snapshot=None, metadata=None)
attr = Attribute(name='status', default=NOTHING, validator=<in_ validator with options ['created', 'ongoing', 'full', 'partia...q=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=<class 'str'>, converter=None, kw_only=False)
value = None
def __call__(self, inst, attr, value):
try:
in_options = value in self.options
except TypeError: # e.g. `1 in "abc"`
in_options = False
if not in_options:
raise ValueError(
"'{name}' must be in {options!r} (got {value!r})".format(
> name=attr.name, options=self.options, value=value
)
)
E ValueError: 'status' must be in ['created', 'ongoing', 'full', 'partial'] (got None)
.tox/py3/lib/python3.7/site-packages/attr/validators.py:230: ValueError
TEST RESULT
TEST RESULT
- Run At
- Jun 25 2020, 9:44 AM