[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
f2c3821dc7
commit
1cb8901b42
|
@ -96,6 +96,22 @@ def sanitize_log_path(path):
|
|||
return path
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
class AttributeDict(dict):
|
||||
|
||||
"""
|
||||
|
|
|
@ -554,7 +554,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,
|
||||
|
|
Loading…
Reference in New Issue