swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f162ccc2710>
swh_storage_backend_config = {'cls': 'cassandra', 'hosts': ['127.0.0.1'], 'journal_writer': {'cls': 'memory'}, 'keyspace': 'bd56fa4d8bbe07632d0a', ...}
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f1625209630>
def test_change_content_pk(
swh_storage: CassandraStorage, swh_storage_backend_config, mocker # noqa
) -> None:
"""Adds a column to the 'content' table and a new matching index;
and make this new column part of the primary key
This is a complex migration, as it requires copying the whole table
"""
content_xor_hash = byte_xor_hash(StorageData.content.data)
# First insert some existing data
> swh_storage.content_add([StorageData.content, StorageData.content2])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_cassandra_migration.py:247:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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/metrics.py:77: in d
r = f(*a, **kw)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:285: in content_add
return self._content_add(list(contents), with_data=True)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:203: in _content_add
for c in contents
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:204: in <listcomp>
if not self._cql_runner.content_get_from_pk(c.to_dict())
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/cql.py:166: in newf
statement: PreparedStatement = self._session.prepare(query)
cassandra/cluster.py:3072: in cassandra.cluster.Session.prepare
???
cassandra/cluster.py:3069: in cassandra.cluster.Session.prepare
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Undefined column name sha1 in table bd56fa4d8bbe07632d0a.content"
cassandra/cluster.py:4894: InvalidRequest
TEST RESULT
TEST RESULT
- Run At
- Oct 18 2021, 1:45 PM