Fix currently broken and inactive mysql tests

Commit 868dd84854 added a
migration script that caused there to be two heads (starting
points) of migrations which would cause alembic to be unable
to do the initial schema creation (and upgrade).

So this fixes that by correctly making one head only and
not skipping tests for a database if it can not be
upgraded for whatever reason (which was silencing the
test failures).

Closes-bug: #1528683

Change-Id: Id571072eec1dc3b6cbb9e868854f6db0b271e5f8
This commit is contained in:
Joshua Harlow
2015-12-22 12:33:03 -08:00
committed by Thomas Goirand
parent 387ba194b6
commit f88b15a526
2 changed files with 3 additions and 6 deletions

View File

@@ -17,14 +17,14 @@
"""Switch postgres to json native type. """Switch postgres to json native type.
Revision ID: 2ad4984f2864 Revision ID: 2ad4984f2864
Revises: 589dccdf2b6e Revises: 3162c0f3f8e4
Create Date: 2015-06-04 13:08:36.667948 Create Date: 2015-06-04 13:08:36.667948
""" """
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '2ad4984f2864' revision = '2ad4984f2864'
down_revision = '589dccdf2b6e' down_revision = '3162c0f3f8e4'
from alembic import op from alembic import op

View File

@@ -160,14 +160,11 @@ class BackendPersistenceTestMixin(base.PersistenceTestMixin):
except Exception as e: except Exception as e:
self.skipTest("Failed to create temporary database;" self.skipTest("Failed to create temporary database;"
" testing being skipped due to: %s" % (e)) " testing being skipped due to: %s" % (e))
try: else:
self.backend = impl_sqlalchemy.SQLAlchemyBackend(self.db_conf) self.backend = impl_sqlalchemy.SQLAlchemyBackend(self.db_conf)
self.addCleanup(self.backend.close) self.addCleanup(self.backend.close)
with contextlib.closing(self._get_connection()) as conn: with contextlib.closing(self._get_connection()) as conn:
conn.upgrade() conn.upgrade()
except Exception as e:
self.skipTest("Failed to setup your database;"
" testing being skipped due to: %s" % (e))
@testtools.skipIf(not _mysql_exists(), 'mysql is not available') @testtools.skipIf(not _mysql_exists(), 'mysql is not available')