diff options
author | Sean Dague <sdague@linux.vnet.ibm.com> | 2013-01-19 14:33:04 -0500 |
---|---|---|
committer | Sean Dague <sdague@linux.vnet.ibm.com> | 2013-01-21 18:03:38 -0500 |
commit | 65b3b443503f993a8001e761b0768fe05c99bf68 (patch) | |
tree | cdd630a894e505853531803b86cb305f6e0bbd41 | |
parent | fa03b1c6ca1fcb45269fe8a6e869ed92dafae602 (diff) | |
download | nova-65b3b443503f993a8001e761b0768fe05c99bf68.tar.gz nova-65b3b443503f993a8001e761b0768fe05c99bf68.tar.xz nova-65b3b443503f993a8001e761b0768fe05c99bf68.zip |
fix mysql race in tests
because of testr, we can't assume the migrations tests run in
sequence, so they make run all at the same time. This is fine for
our in memory sqlite db, but when talking to a real external
database, not so good.
Since a second mysql test was added, we started racing on these
migrations them often hitting at the same time causing random fails
in gate.
Fix this by moving all the mysql tests into 1 test function, so we
won't race.
Fixes bug #1101874
Change-Id: I7627f3bd510266c99af018d355f960b352573759
-rw-r--r-- | nova/tests/test_migrations.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/nova/tests/test_migrations.py b/nova/tests/test_migrations.py index abd04a641..82c958898 100644 --- a/nova/tests/test_migrations.py +++ b/nova/tests/test_migrations.py @@ -222,7 +222,7 @@ class TestMigrations(test.TestCase): if _is_backend_avail('mysql', user="openstack_cifail"): self.fail("Shouldn't have connected") - def test_mysql_innodb(self): + def test_mysql_opportunistically(self): # Test that table creation on mysql only builds InnoDB tables if not _is_backend_avail('mysql'): self.skipTest("mysql not available") @@ -233,6 +233,12 @@ class TestMigrations(test.TestCase): self.engines["mysqlcitest"] = engine self.test_databases["mysqlcitest"] = connect_string + # Test that we end in an innodb + self._check_mysql_innodb(engine) + # Test IP transition + self._check_mysql_migration_149(engine) + + def _check_mysql_innodb(self, engine): # build a fully populated mysql database with all the tables self._reset_databases() self._walk_versions(engine, False, False) @@ -298,16 +304,8 @@ class TestMigrations(test.TestCase): "AND column_name='cidr'").scalar()) connection.close() - def test_migration_149_mysql(self): + def _check_mysql_migration_149(self, engine): """Test updating a table with IPAddress columns.""" - if not _have_mysql(): - self.skipTest("mysql not available") - - connect_string = _get_connect_string("mysql") - engine = sqlalchemy.create_engine(connect_string) - self.engines["mysqlcitest"] = engine - self.test_databases["mysqlcitest"] = connect_string - self._reset_databases() migration_api.version_control(engine, TestMigrations.REPOSITORY, migration.INIT_VERSION) |