Integer Flavor Ids

Changed the flavor id type in the instances schema to an Integer in a patch.
Made changes to the test code. XML attributes are strings so made changes in code to handle that.

Fixes Bug #1165077

Change-Id: I6272c4cf9d22a6090f41b41a66e52506068532cc
This commit is contained in:
Riddhi Shah 2013-06-05 12:07:40 -05:00
parent 792cd12158
commit b93ea02cf9
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)