Merge "Added Trove (database) version API tests"
This commit is contained in:
commit
3df6ac77f1
@ -454,6 +454,10 @@
|
||||
# value)
|
||||
#db_flavor_ref=1
|
||||
|
||||
# Current database version to use in database tests. (string
|
||||
# value)
|
||||
#db_current_version=v1.0
|
||||
|
||||
|
||||
[debug]
|
||||
|
||||
|
@ -36,7 +36,9 @@ class BaseDatabaseTest(tempest.test.BaseTestCase):
|
||||
|
||||
cls.catalog_type = CONF.database.catalog_type
|
||||
cls.db_flavor_ref = CONF.database.db_flavor_ref
|
||||
cls.db_current_version = CONF.database.db_current_version
|
||||
|
||||
os = cls.get_client_manager()
|
||||
cls.os = os
|
||||
cls.database_flavors_client = cls.os.database_flavors_client
|
||||
cls.database_versions_client = cls.os.database_versions_client
|
||||
|
0
tempest/api/database/versions/__init__.py
Normal file
0
tempest/api/database/versions/__init__.py
Normal file
40
tempest/api/database/versions/test_versions.py
Normal file
40
tempest/api/database/versions/test_versions.py
Normal file
@ -0,0 +1,40 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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 tempest.api.database import base
|
||||
from tempest import test
|
||||
|
||||
|
||||
class DatabaseVersionsTest(base.BaseDatabaseTest):
|
||||
_interface = 'json'
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(DatabaseVersionsTest, cls).setUpClass()
|
||||
cls.client = cls.database_versions_client
|
||||
|
||||
@test.attr(type='smoke')
|
||||
def test_list_db_versions(self):
|
||||
resp, versions = self.client.list_db_versions()
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertTrue(len(versions) > 0, "No database versions found")
|
||||
# List of all versions should contain the current version, and there
|
||||
# should only be one 'current' version
|
||||
current_versions = list()
|
||||
for version in versions:
|
||||
if 'CURRENT' == version['status']:
|
||||
current_versions.append(version['id'])
|
||||
self.assertEqual(1, len(current_versions))
|
||||
self.assertIn(self.db_current_version, current_versions)
|
@ -117,6 +117,8 @@ from tempest.services.compute.xml.volumes_extensions_client import \
|
||||
from tempest.services.data_processing.v1_1.client import DataProcessingClient
|
||||
from tempest.services.database.json.flavors_client import \
|
||||
DatabaseFlavorsClientJSON
|
||||
from tempest.services.database.json.versions_client import \
|
||||
DatabaseVersionsClientJSON
|
||||
from tempest.services.identity.json.identity_client import IdentityClientJSON
|
||||
from tempest.services.identity.json.identity_client import TokenClientJSON
|
||||
from tempest.services.identity.v3.json.credentials_client import \
|
||||
@ -345,6 +347,8 @@ class Manager(manager.Manager):
|
||||
self.hosts_v3_client = HostsV3ClientJSON(self.auth_provider)
|
||||
self.database_flavors_client = DatabaseFlavorsClientJSON(
|
||||
self.auth_provider)
|
||||
self.database_versions_client = DatabaseVersionsClientJSON(
|
||||
self.auth_provider)
|
||||
self.queuing_client = QueuingClientJSON(self.auth_provider)
|
||||
if CONF.service_available.ceilometer:
|
||||
self.telemetry_client = TelemetryClientJSON(
|
||||
|
@ -566,6 +566,9 @@ DatabaseGroup = [
|
||||
cfg.StrOpt('db_flavor_ref',
|
||||
default="1",
|
||||
help="Valid primary flavor to use in database tests."),
|
||||
cfg.StrOpt('db_current_version',
|
||||
default="v1.0",
|
||||
help="Current database version to use in database tests."),
|
||||
]
|
||||
|
||||
orchestration_group = cfg.OptGroup(name='orchestration',
|
||||
|
38
tempest/services/database/json/versions_client.py
Normal file
38
tempest/services/database/json/versions_client.py
Normal file
@ -0,0 +1,38 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
import urllib
|
||||
|
||||
from tempest.common import rest_client
|
||||
from tempest import config
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class DatabaseVersionsClientJSON(rest_client.RestClient):
|
||||
|
||||
def __init__(self, auth_provider):
|
||||
super(DatabaseVersionsClientJSON, self).__init__(auth_provider)
|
||||
self.skip_path()
|
||||
self.service = CONF.database.catalog_type
|
||||
|
||||
def list_db_versions(self, params=None):
|
||||
"""List all versions."""
|
||||
url = ''
|
||||
if params:
|
||||
url += '?%s' % urllib.urlencode(params)
|
||||
|
||||
resp, body = self.get(url)
|
||||
return resp, self._parse_resp(body)
|
Loading…
Reference in New Issue
Block a user