swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f1636284a20>
swh_storage_backend_config = {'cls': 'cassandra', 'hosts': ['127.0.0.1'], 'journal_writer': {'cls': 'memory'}, 'keyspace': 'bd56fa4d8bbe07632d0a', ...}
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f163289eef0>
def test_add_content_column(
swh_storage: CassandraStorage, swh_storage_backend_config, mocker # noqa
) -> None:
"""Adds a column to the 'content' table and a new matching index.
This is a simple migration, as it does not require an update to the primary key.
"""
content_xor_hash = byte_xor_hash(StorageData.content.data)
# First insert some existing data
swh_storage.content_add([StorageData.content, StorageData.content2])
# Then update the schema
> swh_storage._cql_runner._session.execute("ALTER TABLE content ADD byte_xor blob")
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_cassandra_migration.py:117:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassandra/cluster.py:2618: in cassandra.cluster.Session.execute
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Column with name 'byte_xor' already exists"
cassandra/cluster.py:4894: InvalidRequest
TEST RESULT
TEST RESULT
- Run At
- Oct 18 2021, 1:45 PM