self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f7a30196a58>
swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f7a300c3668>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f7a3011bf60>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f7a302440b8>
def test_content_get_partition_murmur3_collision(
self, swh_storage, mocker, sample_data
):
"""The Murmur3 token is used as link from index tables to the main table; and
non-matching contents with colliding murmur3-hash are filtered-out when reading
the main table.
This test checks the content_get_partition endpoints return all contents, even
the collisions.
"""
called = 0
rows: Dict[int, Dict] = {}
for tok, content in enumerate(sample_data.contents):
cont = attr.evolve(content, data=None)
row_d = {**cont.to_dict(), "tok": tok}
rows[tok] = row_d
# For all tokens, always return cont
keys = set(["tok"] + list(content.to_dict().keys())).difference(set(["data"]))
Row = namedtuple("Row", keys)
def mock_content_get_token_range(range_start, range_end, limit):
nonlocal called
called += 1
for tok in list(rows.keys()) * 3: # yield multiple times the same tok
row_d = rows[tok]
yield Row(**row_d)
mocker.patch.object(
swh_storage._cql_runner,
"content_get_token_range",
mock_content_get_token_range,
)
actual_results = list(
stream_results(
> swh_storage.content_get_partition, partition_id=0, nb_partitions=1
)
)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_cassandra.py:364:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/core/api/classes.py:40: in stream_results
page_result = f(*args, page_token=page_token, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:199: in content_get_partition
for counter, row in enumerate(rows):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
range_start = -9223372036854775808, range_end = 9223372036854775807
limit = 1001
def mock_content_get_token_range(range_start, range_end, limit):
nonlocal called
called += 1
for tok in list(rows.keys()) * 3: # yield multiple times the same tok
row_d = rows[tok]
> yield Row(**row_d)
E TypeError: __new__() missing 1 required positional argument: 'ctime'
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_cassandra.py:354: TypeError
TEST RESULT
TEST RESULT
- Run At
- Aug 7 2020, 11:15 AM