sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7ff1c02f82e8>
def test_buffering_proxy_storage_content_deduplicate(sample_data) -> None:
contents = sample_data.contents[:2]
storage = get_storage_with_buffer_config(min_batch_size={"content": 2,})
s = storage.content_add([contents[0], contents[0]])
assert s == {}
s = storage.content_add([contents[0]])
assert s == {}
s = storage.content_add([contents[1]])
assert s == {
"content:add": 1 + 1,
"content:add:bytes": contents[0].length + contents[1].length,
}
missing_contents = storage.content_missing([c.to_dict() for c in contents])
> assert list(missing_contents) == []
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_buffer.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.in_memory.InMemoryStorage object at 0x7ff1c02f8160>
contents = [{'blake2s256': b"\xd5\xfe\x199We'\xe4,\xfdv\xa9EZ$2\xfe\x7fVf\x95dW}\xd9<B\x80\xe7mf\x1d", 'data': b'42\n', 'length':...'data': b'4242\n', 'length': 5, 'sha1': b'a\xc2\xb3\xa3\x04\x96\xd3)\xe2\x1a\xf7\r\xd2\xd7\xe0\x97\x04m\x07\xb7', ...}]
key_hash = 'sha1'
@timed
def content_missing(
self, contents: List[Dict[str, Any]], key_hash: str = "sha1"
) -> Iterable[bytes]:
if key_hash not in DEFAULT_ALGORITHMS:
raise StorageArgumentException(
"key_hash should be one of {','.join(DEFAULT_ALGORITHMS)}"
)
contents_with_all_hashes = []
contents_with_missing_hashes = []
for content in contents:
if DEFAULT_ALGORITHMS <= set(content):
contents_with_all_hashes.append(content)
else:
contents_with_missing_hashes.append(content)
# These contents can be queried efficiently directly in the main table
> for content in self._cql_runner.content_missing_from_all_hashes(
contents_with_all_hashes
):
E AttributeError: 'InMemoryCqlRunner' object has no attribute 'content_missing_from_all_hashes'
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:406: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Jan 6 2022, 5:39 PM