Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_cassandra.py
Show First 20 Lines • Show All 261 Lines • ▼ Show 20 Lines | ): | ||||
Row(**{col: getattr(cont, col) for col in cols}) | Row(**{col: getattr(cont, col) for col in cols}) | ||||
for cont in [cont, cont2] | for cont in [cont, cont2] | ||||
] | ] | ||||
mocker.patch.object( | mocker.patch.object( | ||||
swh_storage._cql_runner, "content_get_from_token", mock_cgft | swh_storage._cql_runner, "content_get_from_token", mock_cgft | ||||
) | ) | ||||
actual_result = swh_storage.content_get_metadata([cont.sha1]) | actual_result = swh_storage.content_get([cont.sha1]) | ||||
assert called == 2 | assert called == 2 | ||||
# dropping extra column not returned | # dropping extra column not returned | ||||
expected_cont = attr.evolve(cont, data=None, ctime=None).to_dict() | expected_cont = attr.evolve(cont, data=None) | ||||
del expected_cont["ctime"] # forced to pop it as to_dict does not | |||||
# but cont2 should be filtered out | # but cont2 should be filtered out | ||||
assert actual_result == {cont.sha1: [expected_cont]} | assert actual_result == [expected_cont] | ||||
def test_content_find_murmur3_collision(self, swh_storage, mocker, sample_data): | def test_content_find_murmur3_collision(self, swh_storage, mocker, sample_data): | ||||
"""The Murmur3 token is used as link from index tables to the main | """The Murmur3 token is used as link from index tables to the main | ||||
table; and non-matching contents with colliding murmur3-hash | table; and non-matching contents with colliding murmur3-hash | ||||
are filtered-out when reading the main table. | are filtered-out when reading the main table. | ||||
This test checks the content methods do filter out these collisions. | This test checks the content methods do filter out these collisions. | ||||
""" | """ | ||||
called = 0 | called = 0 | ||||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |