Merge "storage: fix clear/upgrade order"

This commit is contained in:
Jenkins 2013-07-17 13:48:56 +00:00 committed by Gerrit Code Review
commit 962c6a9533
2 changed files with 7 additions and 4 deletions

View File

@ -286,6 +286,12 @@ class Connection(base.Connection):
if 'username' in opts:
self.db.authenticate(opts['username'], opts['password'])
# NOTE(jd) Upgrading is just about creating index, so let's do this
# on connection to be sure at least the TTL is correcly updated if
# needed.
self.upgrade()
def upgrade(self, version=None):
# Establish indexes
#
# We need variations for user_id vs. project_id because of the
@ -341,10 +347,6 @@ class Connection(base.Connection):
# Assume is not supported if we can get the version
return self.conn.server_info().get('versionArray', []) >= [2, 2]
@staticmethod
def upgrade(version=None):
pass
def clear(self):
self.conn.drop_database(self.db)

View File

@ -34,3 +34,4 @@ class TestBase(test_base.TestCase):
self.conn = storage.get_connection(cfg.CONF)
self.conn.upgrade()
self.conn.clear()
self.conn.upgrade()