self = <swh.storage.tests.test_in_memory.TestInMemoryStorage object at 0x7fef7d153080>
swh_storage = <swh.storage.in_memory.InMemoryStorage object at 0x7fef7d153240>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fef7f22a358>
def test_object_find_by_sha1_git(self, swh_storage, sample_data):
content = sample_data.content
directory = sample_data.directory
revision = sample_data.revision
release = sample_data.release
sha1_gits = [b"00000000000000000000"]
expected = {
b"00000000000000000000": [],
}
swh_storage.content_add([content])
sha1_gits.append(content.sha1_git)
expected[content.sha1_git] = [
{"sha1_git": content.sha1_git, "type": "content",}
]
swh_storage.directory_add([directory])
sha1_gits.append(directory.id)
expected[directory.id] = [{"sha1_git": directory.id, "type": "directory",}]
swh_storage.revision_add([revision])
sha1_gits.append(revision.id)
expected[revision.id] = [{"sha1_git": revision.id, "type": "revision",}]
swh_storage.release_add([release])
sha1_gits.append(release.id)
expected[release.id] = [{"sha1_git": release.id, "type": "release",}]
> ret = swh_storage.object_find_by_sha1_git(sha1_gits)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/storage_tests.py:4249:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/metrics.py:24: in d
return f(*a, **kw)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:983: in object_find_by_sha1_git
found_ids = missing_ids - set(query_fn(list(missing_ids)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.in_memory.InMemoryStorage object at 0x7fef7d153240>
contents = [{'sha1_git': b'00000000000000000000'}, {'sha1_git': b'\xd8\x1c\xc0q\x0e\xb6\xcf\x9e\xfd[\x92\n\x84S\xe1\xe0qW\xb6\xcd'}, {'sha1_git': b'RV\xe8V\xa0\xa0\x89\x89f\xd6\xba\x14\xfe\xb48\x8b\x8b\x82\xd3\x02'}]
key_hash = 'sha1_git'
@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