Merge "[Functional] Increase test_timeout for db migration tests"

This commit is contained in:
Zuul 2018-10-17 14:58:45 +00:00 committed by Gerrit Code Review
commit ee5fb8744c
2 changed files with 28 additions and 1 deletions

View File

@ -109,6 +109,22 @@ def unstable_test(reason):
return decor
def set_timeout(timeout):
"""Timeout decorator for test methods.
Use this decorator for tests that are expected to pass in very specific
amount of time, not common for all other tests.
It can have either big or small value.
"""
def decor(f):
@functools.wraps(f)
def inner(self, *args, **kwargs):
self.useFixture(fixtures.Timeout(timeout, gentle=True))
return f(self, *args, **kwargs)
return inner
return decor
def get_rootwrap_cmd():
return os.environ.get('OS_ROOTWRAP_CMD', SUDO_CMD)

View File

@ -577,7 +577,18 @@ class _TestWalkMigrations(object):
class TestWalkMigrationsMysql(testlib_api.MySQLTestCaseMixin,
_TestWalkMigrations,
testlib_api.SqlTestCaseLight):
pass
# NOTE(slaweq): this workaround is taken from Manila patch:
# https://review.openstack.org/#/c/291397/
# Set 5 minutes timeout for case of running it on
# very slow nodes/VMs. Note, that this test becomes slower with each
# addition of new DB migration. On fast nodes it can take about 5-10
# secs having Mitaka set of migrations. 'pymysql' works much slower
# on slow nodes than 'psycopg2' and because of that this increased
# timeout is required only when for testing with 'mysql' backend.
@test_base.set_timeout(300)
def test_walk_versions(self):
super(TestWalkMigrationsMysql, self).test_walk_versions()
class TestWalkMigrationsPsql(testlib_api.PostgreSQLTestCaseMixin,