Group execution of SQL functional tests
Functional SQL tests (MySQL and PostgreSQL) use the DB installed backend. To avoid overloading the DB engine, the test cases are grouped [1] together and executed by the same worker process. That will ensure those tests are not executed in parallel, interfering each other. All test classes ended in "MySQL" or "PostgreSQL" are now grouped. That means the tests implemented inside the same class are executed in the same worker, not in parallel. **HOWEVER**, that doesn't guarantee all test cases using the same database backend will run in the same worker serially. The FT job can still execute test cases from different classes, using the same DB backend, in two workers at the same time. This patch also fixes the ``TestReservation*`` classes to inherit from the parent classes in the correct order. That sets the "DRIVER" value to the expected one "mysql" or "postgresql". [1]https://review.opendev.org/c/openstack/neutron/+/785568 Closes-Bug: #1962594 Related-Bug: #1687027 Change-Id: I6bca7daf4d3e46071686bb62d5988ae314af8e7e
This commit is contained in:
parent
6a571f8068
commit
4a66adf94c
@ -78,13 +78,13 @@ class NetworkDhcpAgentBindingMigrationMixin(object):
|
||||
self.assertEqual(list(range(1, 3)), sorted(binding_indices))
|
||||
|
||||
|
||||
class TestNetworkDhcpAgentBindingMigrationMysql(
|
||||
class TestNetworkDhcpAgentBindingMigrationMySQL(
|
||||
NetworkDhcpAgentBindingMigrationMixin,
|
||||
test_migrations.TestWalkMigrationsMysql):
|
||||
test_migrations.TestWalkMigrationsMySQL):
|
||||
pass
|
||||
|
||||
|
||||
class TestNetworkDhcpAgentBindingMigrationPsql(
|
||||
NetworkDhcpAgentBindingMigrationMixin,
|
||||
test_migrations.TestWalkMigrationsPsql):
|
||||
class TestNetworkDhcpAgentBindingMigrationPostgreSQL(
|
||||
NetworkDhcpAgentBindingMigrationMixin,
|
||||
test_migrations.TestWalkMigrationsPostgreSQL):
|
||||
pass
|
||||
|
@ -140,9 +140,9 @@ class IpamTestCase(testlib_api.SqlTestCase):
|
||||
self._create_port(self.port_id)
|
||||
|
||||
|
||||
class TestIpamMySql(testlib_api.MySQLTestCaseMixin, IpamTestCase):
|
||||
class TestIpamMySQL(testlib_api.MySQLTestCaseMixin, IpamTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class TestIpamPsql(testlib_api.PostgreSQLTestCaseMixin, IpamTestCase):
|
||||
class TestIpamPostgreSQL(testlib_api.PostgreSQLTestCaseMixin, IpamTestCase):
|
||||
pass
|
||||
|
@ -340,7 +340,7 @@ class _TestModelsMigrations(test_migrations.ModelsMigrationsSync):
|
||||
msg='Offline contract migration scripts are forbidden for Ocata+')
|
||||
|
||||
|
||||
class TestModelsMigrationsMysql(testlib_api.MySQLTestCaseMixin,
|
||||
class TestModelsMigrationsMySQL(testlib_api.MySQLTestCaseMixin,
|
||||
_TestModelsMigrations,
|
||||
testlib_api.SqlTestCaseLight,
|
||||
functional_base.BaseLoggingTestCase):
|
||||
@ -364,12 +364,12 @@ class TestModelsMigrationsMysql(testlib_api.MySQLTestCaseMixin,
|
||||
self.assertEqual(0, len(res), "%s non InnoDB tables created" % res)
|
||||
|
||||
def test_models_sync(self):
|
||||
super(TestModelsMigrationsMysql, self).test_models_sync()
|
||||
super(TestModelsMigrationsMySQL, self).test_models_sync()
|
||||
|
||||
|
||||
class TestModelsMigrationsPsql(testlib_api.PostgreSQLTestCaseMixin,
|
||||
_TestModelsMigrations,
|
||||
testlib_api.SqlTestCaseLight):
|
||||
class TestModelsMigrationsPostgreSQL(testlib_api.PostgreSQLTestCaseMixin,
|
||||
_TestModelsMigrations,
|
||||
testlib_api.SqlTestCaseLight):
|
||||
pass
|
||||
|
||||
|
||||
@ -575,7 +575,7 @@ class _TestWalkMigrations(object):
|
||||
migration.do_alembic_command(config, 'upgrade', dest)
|
||||
|
||||
|
||||
class TestWalkMigrationsMysql(testlib_api.MySQLTestCaseMixin,
|
||||
class TestWalkMigrationsMySQL(testlib_api.MySQLTestCaseMixin,
|
||||
_TestWalkMigrations,
|
||||
testlib_api.SqlTestCaseLight):
|
||||
|
||||
@ -589,10 +589,10 @@ class TestWalkMigrationsMysql(testlib_api.MySQLTestCaseMixin,
|
||||
# timeout is required only when for testing with 'mysql' backend.
|
||||
@test_base.set_timeout(600)
|
||||
def test_walk_versions(self):
|
||||
super(TestWalkMigrationsMysql, self).test_walk_versions()
|
||||
super(TestWalkMigrationsMySQL, self).test_walk_versions()
|
||||
|
||||
|
||||
class TestWalkMigrationsPsql(testlib_api.PostgreSQLTestCaseMixin,
|
||||
_TestWalkMigrations,
|
||||
testlib_api.SqlTestCaseLight):
|
||||
class TestWalkMigrationsPostgreSQL(testlib_api.PostgreSQLTestCaseMixin,
|
||||
_TestWalkMigrations,
|
||||
testlib_api.SqlTestCaseLight):
|
||||
pass
|
||||
|
@ -62,10 +62,11 @@ class _ReservationSql(testlib_api.SqlTestCase):
|
||||
self.assertIsInstance(res_map['port'], int)
|
||||
|
||||
|
||||
class TestReservationMySQL(_ReservationSql, testlib_api.MySQLTestCaseMixin):
|
||||
class TestReservationMySQL(testlib_api.MySQLTestCaseMixin,
|
||||
_ReservationSql):
|
||||
pass
|
||||
|
||||
|
||||
class TestReservationPostgreSQL(_ReservationSql,
|
||||
testlib_api.PostgreSQLTestCaseMixin):
|
||||
class TestReservationPostgreSQL(testlib_api.PostgreSQLTestCaseMixin,
|
||||
_ReservationSql):
|
||||
pass
|
||||
|
2
tox.ini
2
tox.ini
@ -63,7 +63,7 @@ deps =
|
||||
{[testenv:functional]deps}
|
||||
commands =
|
||||
{toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
|
||||
stestr run --group_regex=neutron\.tests\.functional\.db\.test_migrations\.(TestModelsMigrationsPsql|TestModelsMigrationsMysql) {posargs}
|
||||
stestr run --group_regex=(.*MySQL\.|.*PostgreSQL\.) {posargs}
|
||||
|
||||
[testenv:dsvm-fullstack]
|
||||
setenv = {[testenv]setenv}
|
||||
|
Loading…
Reference in New Issue
Block a user