Fix lock range, again

This commit fixes lock range. We should get a lock before connecting to
a database.

Change-Id: Iecca74db980d3660248ad9dba6ddccd656f439bd
This commit is contained in:
Masayuki Igawa
2016-04-07 14:19:49 +09:00
committed by Matthew Treinish
parent 0ed3e18acc
commit 5557641fea
2 changed files with 3 additions and 3 deletions

View File

@@ -138,10 +138,10 @@ class TestWalkMigrations(base.TestCase):
self.fail("Shouldn't have connected")
def test_mysql_opportunistically(self):
self.useFixture(fixtures.LockFixture('mysql'))
if not db_test_utils.is_backend_avail('mysql'):
raise self.skipTest('mysql is not available')
self.useFixture(fixtures.LockFixture('mysql'))
self.useFixture(fixtures.MySQLConfFixture())
# Test that table creation on mysql only builds InnoDB tables
# add this to the global lists to make reset work with it, it's removed
@@ -182,9 +182,9 @@ class TestWalkMigrations(base.TestCase):
def test_postgresql_opportunistically(self):
# Test postgresql database migration walk
self.useFixture(fixtures.LockFixture('postgres'))
if not db_test_utils.is_backend_avail('postgres'):
raise self.skipTest('postgres is not available')
self.useFixture(fixtures.LockFixture('postgres'))
self.useFixture(fixtures.PostgresConfFixture())
# add this to the global lists to make reset work with it, it's removed
# automatically in tearDown so no need to clean it up here.

View File

@@ -79,12 +79,12 @@ class TestModelsMigrations(test_migrations.ModelsMigrationsSync,
def setUp(self):
super(TestModelsMigrations, self).setUp()
self.useFixture(fixtures.LockFixture(self.dialect))
if not db_test_utils.is_backend_avail(self.dialect):
raise self.skipTest('%s is not available' % self.dialect)
if self.dialect == 'sqlite':
raise self.skipException('sqlite skipped because of model sync '
'issue with BigInteger vs Integer')
self.useFixture(fixtures.LockFixture(self.dialect))
if self.dialect == 'mysql':
self.useFixture(fixtures.MySQLConfFixture())
elif self.dialect == 'postgres':