[Functional] Increase test_timeout for db migration tests
In Neutron we hit quite often same issue as Manila, see [1] for
details.
It looks that solution for this problem may be increase timeout
for test_walk_version functional tests.
Higher timeout will be applied for tests for both pgsql and mysql
backends but it is mostly needed for mysql because 'pymysql' works
much slower on slow nodes than 'psycopg2'
This patch adds also new decorator to set individual timeout for
tests.
[1] https://bugs.launchpad.net/manila/+bug/1501272
Change-Id: I5f344af6dc3e5a6ee5f52c250b6c719e1b43e02d
Closes-Bug: #1687027
(cherry picked from commit c2c37272bf
)
This commit is contained in:
parent
8bb898705f
commit
026d911832
|
@ -112,6 +112,22 @@ def unstable_test(reason):
|
||||||
return decor
|
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():
|
def get_rootwrap_cmd():
|
||||||
return os.environ.get('OS_ROOTWRAP_CMD', SUDO_CMD)
|
return os.environ.get('OS_ROOTWRAP_CMD', SUDO_CMD)
|
||||||
|
|
||||||
|
|
|
@ -577,7 +577,18 @@ class _TestWalkMigrations(object):
|
||||||
class TestWalkMigrationsMysql(testlib_api.MySQLTestCaseMixin,
|
class TestWalkMigrationsMysql(testlib_api.MySQLTestCaseMixin,
|
||||||
_TestWalkMigrations,
|
_TestWalkMigrations,
|
||||||
testlib_api.SqlTestCaseLight):
|
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,
|
class TestWalkMigrationsPsql(testlib_api.PostgreSQLTestCaseMixin,
|
||||||
|
|
Loading…
Reference in New Issue