Merge "Integer Flavor Ids"

This commit is contained in:
Jenkins 2013-06-07 02:43:51 +00:00 committed by Gerrit Code Review
commit c387692d50
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,36 @@
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
#modify column
instances.c.flavor_id.alter(type=Integer())
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# modify column:
instances = Table('instances', meta, autoload=True)
instances.c.flavor_id.alter(type=String(36))

View File

@ -36,6 +36,10 @@ from reddwarf.tests.api.instances import GROUP_TEST
from reddwarf.tests.util import poll_until
GROUP = "dbaas.api.mgmt.instances"
XML_SUPPORT = False
if hasattr(CONFIG, 'reddwarf_client_cls'):
if CONFIG.reddwarf_client_cls == "reddwarfclient.xml.ReddwarfXmlClient":
XML_SUPPORT = True
@test(groups=[GROUP])
@ -48,7 +52,10 @@ def mgmt_index_requires_admin_account():
# These functions check some dictionaries in the returned response.
def flavor_check(flavor):
with CollectionCheck("flavor", flavor) as check:
check.has_element("id", basestring)
if XML_SUPPORT:
check.has_element("id", basestring)
else:
check.has_element("id", int)
check.has_element("links", list)