self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f9b326689b0>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f9b32668240>
sample_data_model = {'authority': [MetadataAuthority(type=<MetadataAuthorityType.DEPOSIT_CLIENT: 'deposit_client'>, url='http://hal.inria.... perms=<DentryPerms.directory: 16384>),), id=b'7z\xa5\xfc\xd9D\xfb\xab\xf5\x02\xdb\xfd\xa5\\\xd1M3\xc8\xc3\xc6')], ...}
def test_stat_counters(self, swh_storage, sample_data_model):
origin = sample_data_model["origin"][0]
snapshot = sample_data_model["snapshot"][0]
revision = sample_data_model["revision"][0]
release = sample_data_model["release"][0]
directory = sample_data_model["directory"][0]
content = sample_data_model["content"][0]
expected_keys = ["content", "directory", "origin", "revision"]
# Initially, all counters are 0
swh_storage.refresh_stat_counters()
counters = swh_storage.stat_counters()
assert set(expected_keys) <= set(counters)
for key in expected_keys:
assert counters[key] == 0
# Add a content. Only the content counter should increase.
swh_storage.content_add([content])
swh_storage.refresh_stat_counters()
counters = swh_storage.stat_counters()
assert set(expected_keys) <= set(counters)
for key in expected_keys:
if key != "content":
assert counters[key] == 0
assert counters["content"] == 1
# Add other objects. Check their counter increased as well.
swh_storage.origin_add([origin])
visit = OriginVisit(
origin=origin.url, date=data.date_visit2, type=data.type_visit2,
)
origin_visit1 = swh_storage.origin_visit_add([visit])[0]
swh_storage.snapshot_add([snapshot])
swh_storage.origin_visit_status_add(
[
OriginVisitStatus(
origin=origin.url,
visit=origin_visit1.visit,
date=now(),
status="ongoing",
snapshot=snapshot.id,
)
]
)
swh_storage.directory_add([directory])
swh_storage.revision_add([revision])
swh_storage.release_add([release])
swh_storage.refresh_stat_counters()
counters = swh_storage.stat_counters()
assert counters["content"] == 1
assert counters["directory"] == 1
assert counters["snapshot"] == 1
assert counters["origin"] == 1
assert counters["origin_visit"] == 1
assert counters["revision"] == 1
assert counters["release"] == 1
> assert counters["snapshote"] == 1
E KeyError: 'snapshote'
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:3006: KeyError
TEST RESULT
TEST RESULT
- Run At
- Jul 20 2020, 5:53 PM