summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGorka Eguileor <geguileo@redhat.com>2023-02-07 13:05:23 +0100
committerGorka Eguileor <geguileo@redhat.com>2023-02-07 13:17:52 +0100
commit7c79e2115ad5fb6b7b3fa9412a5b7f34527bbad5 (patch)
treeadd951d6f4c786dcd4210a3d3a9dbd1a1670e868 /doc
parentf11ff244b78f5d353cfc8c06c21adf63d2f2c5a1 (diff)
downloadcinder-7c79e2115ad5fb6b7b3fa9412a5b7f34527bbad5.tar.gz
Fix Migrations UTs using wrong DB
Our current migrations unit tests are NOT doing the migrations in the DB they should. Migrations are being run in whatever was last used for the normal cinder UTs, which is SQLite. This creates some issues such as: - Migrations can not be run independently, because no "normal cinder UT" has been run before, so there is no DB that the migration can use. This is easy to test: $ . .tox/py310/bin/activate $ stestr run -n cinder.tests.unit.db.test_migrations That will fail with oslo_db.exception.DBNonExistentDatabase because no previous test has created the sqlite DB. If we were to run any other UT before them they would work. - Migrations that run conditional code based on the DB Engine will fail, even when running things conditionally. For example a migration that uses `index_exists` that only works on MySQL will fail even when doing it conditionally and only running it on MySQL, because it will actually be run in SQLite: is_mysql = engine.dialect.name == 'mysql' idx_name = f'{table}_deleted_project_id_idx' + if is_mysql and utils.index_exists(engine, table, idx_name): This patch fixes this by making sure the get_engine method in Cinder returns the same engine that the migration code is using. Change-Id: I15f6e4bd180e9a5af82c76d61658a3cb1eac22c8
Diffstat (limited to 'doc')
0 files changed, 0 insertions, 0 deletions