Allow setting migrations timeout value from tox
The MIGRATIONS_TIMEOUT value is the timeout for the migrations tests in seconds. Can now be set ad environment variable, default to 60 seconds. Change-Id: I20045a7c0c08a37038b4707791f6b67f715c4877
This commit is contained in:
parent
6c05e99c8d
commit
dfb7f05ff0
@ -37,6 +37,7 @@ For postgres on Ubuntu this can be done with the following commands:
|
||||
import collections
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
from alembic import script
|
||||
@ -61,7 +62,8 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
# NOTE(vdrok): This was introduced after migration tests started taking more
|
||||
# time in gate. Timeout value in seconds for tests performing migrations.
|
||||
MIGRATIONS_TIMEOUT = 300
|
||||
# Can be modified in tox.ini as env variable.
|
||||
MIGRATIONS_TIMEOUT = os.getenv('MIGRATIONS_TIMEOUT', 60)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
@ -188,8 +190,8 @@ class MigrationCheckersMixin(object):
|
||||
self.engine = enginefacade.writer.get_engine()
|
||||
self.config = migration._alembic_config()
|
||||
self.migration_api = migration
|
||||
self.useFixture(fixtures.Timeout(MIGRATIONS_TIMEOUT,
|
||||
gentle=True))
|
||||
self.useFixture(fixtures.Timeout(int(MIGRATIONS_TIMEOUT),
|
||||
gentle=False))
|
||||
|
||||
def test_walk_versions(self):
|
||||
self._walk_versions(self.engine, self.config)
|
||||
@ -1439,8 +1441,8 @@ class ModelsMigrationSyncMixin(object):
|
||||
def setUp(self):
|
||||
super(ModelsMigrationSyncMixin, self).setUp()
|
||||
self.engine = enginefacade.writer.get_engine()
|
||||
self.useFixture(fixtures.Timeout(MIGRATIONS_TIMEOUT,
|
||||
gentle=True))
|
||||
self.useFixture(fixtures.Timeout(int(MIGRATIONS_TIMEOUT),
|
||||
gentle=False))
|
||||
|
||||
def get_metadata(self):
|
||||
return models.Base.metadata
|
||||
|
1
tox.ini
1
tox.ini
@ -10,6 +10,7 @@ setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
LANGUAGE=en_US
|
||||
LC_ALL=en_US.UTF-8
|
||||
MIGRATIONS_TIMEOUT={env:MIGRATIONS_TIMEOUT:60}
|
||||
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
|
||||
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
|
||||
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
|
||||
|
Loading…
Reference in New Issue
Block a user