Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/storage_tests.py
Show First 20 Lines • Show All 1,114 Lines • ▼ Show 20 Lines | def test_revision_get_random(self, swh_storage, sample_data): | ||||
swh_storage.revision_add([revision1, revision2, revision3]) | swh_storage.revision_add([revision1, revision2, revision3]) | ||||
assert swh_storage.revision_get_random() in { | assert swh_storage.revision_get_random() in { | ||||
revision1.id, | revision1.id, | ||||
revision2.id, | revision2.id, | ||||
revision3.id, | revision3.id, | ||||
} | } | ||||
def test_revision_missing_many(self, swh_storage, sample_data): | |||||
"""Large number of revision ids to check can cause ScyllaDB to reject | |||||
queries.""" | |||||
revision = sample_data.revision | |||||
ids = [bytes([b1, b2]) * 10 for b1 in range(256) for b2 in range(10)] | |||||
ids.append(revision.id) | |||||
ids.sort() | |||||
init_missing = swh_storage.revision_missing(ids) | |||||
assert set(init_missing) == set(ids) | |||||
actual_result = swh_storage.revision_add([revision]) | |||||
assert actual_result == {"revision:add": 1} | |||||
end_missing = swh_storage.revision_missing(ids) | |||||
assert set(end_missing) == set(ids) - {revision.id} | |||||
def test_extid_add_git(self, swh_storage, sample_data): | def test_extid_add_git(self, swh_storage, sample_data): | ||||
gitids = [ | gitids = [ | ||||
revision.id | revision.id | ||||
for revision in sample_data.revisions | for revision in sample_data.revisions | ||||
if revision.type.value == "git" | if revision.type.value == "git" | ||||
] | ] | ||||
extids = [ | extids = [ | ||||
▲ Show 20 Lines • Show All 3,401 Lines • Show Last 20 Lines |