kafka_prefix = 'trwazqbiah', kafka_server = '127.0.0.1:52229'
consumer = <cimpl.Consumer object at 0x7f7267ea8a60>
def test_storage_direct_writer(kafka_prefix: str, kafka_server, consumer: Consumer):
writer_config = {
"cls": "kafka",
"brokers": [kafka_server],
"client_id": "kafka_writer",
"prefix": kafka_prefix,
"anonymize": False,
}
storage_config = {
"cls": "pipeline",
"steps": [{"cls": "memory", "journal_writer": writer_config},],
}
storage = get_storage(**storage_config)
expected_messages = 0
for obj_type, objs in TEST_OBJECTS.items():
method = getattr(storage, obj_type + "_add")
if obj_type in (
"content",
"skipped_content",
"directory",
"revision",
"release",
"snapshot",
"origin",
"origin_visit_status",
):
method(objs)
expected_messages += len(objs)
elif obj_type in ("origin_visit",):
for obj in objs:
assert isinstance(obj, OriginVisit)
storage.origin_add_one(Origin(url=obj.origin))
> method([obj])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_kafka_writer.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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