Reverts commit that did db migration during configure_db() and makes functional tests use in-memory database again. The issues we were seeing had to do with the timeout not being long enough when starting servers with disk-based registry databases and migrate taking too long when spinning up the registry server... this was shown in almost random failures of tests saying failure to start servers. Rather than increase the timeout from 3 seconds, I reverted the change that runs migrate on every startup and cut the total test duration down about 15 seconds.
This commit is contained in:
parent
3eeb9fec9c
commit
618e4a0aff
|
@ -33,7 +33,6 @@ from sqlalchemy.sql import or_, and_
|
|||
from glance.common import config
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance.registry.db import migration
|
||||
from glance.registry.db import models
|
||||
|
||||
_ENGINE = None
|
||||
|
@ -77,7 +76,7 @@ def configure_db(options):
|
|||
elif verbose:
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
migration.db_sync(options)
|
||||
models.register_models(_ENGINE)
|
||||
|
||||
|
||||
def get_session(autocommit=True, expire_on_commit=False):
|
||||
|
|
|
@ -118,3 +118,12 @@ class ImageProperty(BASE, ModelBase):
|
|||
|
||||
name = Column(String(255), index=True, nullable=False)
|
||||
value = Column(Text)
|
||||
|
||||
|
||||
def register_models(engine):
|
||||
"""
|
||||
Creates database tables for all models with the given engine
|
||||
"""
|
||||
models = (Image, ImageProperty)
|
||||
for model in models:
|
||||
model.metadata.create_all(engine)
|
||||
|
|
|
@ -175,11 +175,7 @@ class RegistryServer(Server):
|
|||
super(RegistryServer, self).__init__(test_dir, port)
|
||||
self.server_name = 'registry'
|
||||
|
||||
# NOTE(sirp): in-memory DBs don't play well with sqlalchemy migrate
|
||||
# (see http://code.google.com/p/sqlalchemy-migrate/
|
||||
# issues/detail?id=72)
|
||||
self.db_file = os.path.join(self.test_dir, 'test_glance_api.sqlite')
|
||||
default_sql_connection = 'sqlite:///%s' % self.db_file
|
||||
default_sql_connection = 'sqlite:///'
|
||||
self.sql_connection = os.environ.get('GLANCE_TEST_SQL_CONNECTION',
|
||||
default_sql_connection)
|
||||
|
||||
|
|
Loading…
Reference in New Issue