Fix py311 unit test issues
- Dell EMC driver had an issue with mocking an object and sending it forward. - Some of the create table statements in the database migrations didn't have the charset specified. That seemed to trick the DB engine while defining foreign keys and adding a name to them, as the default charset was defined in the schema, but not in the tables. This behavior was also noted in different places, like [1]. Fix this issue by adding the charset to all create table statements, so they match the engine default charset. [1] https://github.com/apache/superset/issues/8808 Change-Id: I7cd6fa0cc8e054af112493746e753fef2024000f
This commit is contained in:
parent
1764a22086
commit
b44c36e5ba
@ -64,3 +64,8 @@ possible to use ``manila-manage db revision`` or the corresponding tox command::
|
|||||||
|
|
||||||
In addition every migration script must be tested. See examples in
|
In addition every migration script must be tested. See examples in
|
||||||
``manila/tests/db/migrations/alembic/migrations_data_checks.py``.
|
``manila/tests/db/migrations/alembic/migrations_data_checks.py``.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
When writing database migrations that create tables with unique constraints
|
||||||
|
or foreign keys, please ensure that the ``mysql_charset`` matches the
|
||||||
|
referenced table.
|
||||||
|
@ -60,7 +60,7 @@ def upgrade():
|
|||||||
nullable=False),
|
nullable=False),
|
||||||
sa.Column('spec_key', sa.String(length=255)),
|
sa.Column('spec_key', sa.String(length=255)),
|
||||||
sa.Column('spec_value', sa.String(length=255)),
|
sa.Column('spec_value', sa.String(length=255)),
|
||||||
mysql_engine='InnoDB')
|
mysql_engine='InnoDB', mysql_charset='utf8')
|
||||||
|
|
||||||
LOG.info("Migrating volume_type_extra_specs to "
|
LOG.info("Migrating volume_type_extra_specs to "
|
||||||
"share_type_extra_specs")
|
"share_type_extra_specs")
|
||||||
|
@ -45,7 +45,8 @@ def upgrade():
|
|||||||
sa.ForeignKey('share_snapshots.id',
|
sa.ForeignKey('share_snapshots.id',
|
||||||
name='ssam_snapshot_fk')),
|
name='ssam_snapshot_fk')),
|
||||||
sa.Column('access_type', sa.String(255)),
|
sa.Column('access_type', sa.String(255)),
|
||||||
sa.Column('access_to', sa.String(255))
|
sa.Column('access_to', sa.String(255)),
|
||||||
|
mysql_charset='utf8'
|
||||||
)
|
)
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
@ -62,7 +63,8 @@ def upgrade():
|
|||||||
sa.ForeignKey('share_snapshot_access_map.id',
|
sa.ForeignKey('share_snapshot_access_map.id',
|
||||||
name='ssam_access_fk')),
|
name='ssam_access_fk')),
|
||||||
sa.Column('state', sa.String(255),
|
sa.Column('state', sa.String(255),
|
||||||
default=constants.ACCESS_STATE_QUEUED_TO_APPLY)
|
default=constants.ACCESS_STATE_QUEUED_TO_APPLY),
|
||||||
|
mysql_charset='utf8'
|
||||||
)
|
)
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
@ -76,7 +78,8 @@ def upgrade():
|
|||||||
sa.ForeignKey('share_snapshot_instances.id',
|
sa.ForeignKey('share_snapshot_instances.id',
|
||||||
name='ssiel_snapshot_instance_fk')),
|
name='ssiel_snapshot_instance_fk')),
|
||||||
sa.Column('path', sa.String(2000)),
|
sa.Column('path', sa.String(2000)),
|
||||||
sa.Column('is_admin_only', sa.Boolean, default=False, nullable=False)
|
sa.Column('is_admin_only', sa.Boolean, default=False, nullable=False),
|
||||||
|
mysql_charset='utf8'
|
||||||
)
|
)
|
||||||
|
|
||||||
op.add_column('shares',
|
op.add_column('shares',
|
||||||
|
@ -49,6 +49,7 @@ def upgrade():
|
|||||||
'share_type_id', 'resource', 'deleted',
|
'share_type_id', 'resource', 'deleted',
|
||||||
name="uc_quotas_per_share_types"),
|
name="uc_quotas_per_share_types"),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
mysql_charset='utf8',
|
||||||
)
|
)
|
||||||
for table_name in ('quota_usages', 'reservations'):
|
for table_name in ('quota_usages', 'reservations'):
|
||||||
op.add_column(
|
op.add_column(
|
||||||
|
@ -99,6 +99,7 @@ def upgrade():
|
|||||||
sa.UniqueConstraint('export_location_id', 'key', 'deleted',
|
sa.UniqueConstraint('export_location_id', 'key', 'deleted',
|
||||||
name="elm_el_id_uc"),
|
name="elm_el_id_uc"),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
mysql_charset='utf8',
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error("Failed to create '%s' table!", ELM_TABLE_NAME)
|
LOG.error("Failed to create '%s' table!", ELM_TABLE_NAME)
|
||||||
|
@ -49,6 +49,7 @@ def upgrade():
|
|||||||
sql.UniqueConstraint(
|
sql.UniqueConstraint(
|
||||||
'name', 'deleted', name="uniq_share_group_type_name"),
|
'name', 'deleted', name="uniq_share_group_type_name"),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
mysql_charset='utf8',
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error("Table |%s| not created!", 'share_group_types')
|
LOG.error("Table |%s| not created!", 'share_group_types')
|
||||||
@ -70,6 +71,7 @@ def upgrade():
|
|||||||
sql.ForeignKey(
|
sql.ForeignKey(
|
||||||
'share_group_types.id', name="sgtp_id_extra_specs_fk")),
|
'share_group_types.id', name="sgtp_id_extra_specs_fk")),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
mysql_charset='utf8',
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error("Table |%s| not created!", 'share_group_type_specs')
|
LOG.error("Table |%s| not created!", 'share_group_type_specs')
|
||||||
@ -92,6 +94,7 @@ def upgrade():
|
|||||||
'share_group_type_id', 'project_id', 'deleted',
|
'share_group_type_id', 'project_id', 'deleted',
|
||||||
name="sgtp_project_id_uc"),
|
name="sgtp_project_id_uc"),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
mysql_charset='utf8',
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error("Table |%s| not created!", 'share_group_type_projects')
|
LOG.error("Table |%s| not created!", 'share_group_type_projects')
|
||||||
|
@ -59,6 +59,7 @@ def upgrade():
|
|||||||
sql.UniqueConstraint('share_type_id', 'project_id', 'deleted',
|
sql.UniqueConstraint('share_type_id', 'project_id', 'deleted',
|
||||||
name="stp_project_id_uc"),
|
name="stp_project_id_uc"),
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
|
mysql_charset='utf8'
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error("Table |%s| not created!", 'share_type_projects')
|
LOG.error("Table |%s| not created!", 'share_type_projects')
|
||||||
|
@ -278,7 +278,7 @@ class EMCShareFrameworkTestCase(test.TestCase):
|
|||||||
snapshot_access_rules, share_server)
|
snapshot_access_rules, share_server)
|
||||||
|
|
||||||
def test_unmanage_manage(self):
|
def test_unmanage_manage(self):
|
||||||
share = mock.Mock()
|
share = {}
|
||||||
server_details = {}
|
server_details = {}
|
||||||
share_server = mock.Mock()
|
share_server = mock.Mock()
|
||||||
snapshot = mock.Mock()
|
snapshot = mock.Mock()
|
||||||
|
Loading…
Reference in New Issue
Block a user