blob: d9f903703343e88ef893df2f6ba940d0fcf1cde2 [file] [log] [blame]
Matthew Treinish2324e6b2013-10-21 20:25:17 +00001# Copyright 2013 IBM Corp.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16
17from tempest.api.volume import base
Christian Schwede1acc63a2013-12-27 15:21:32 +000018from tempest.openstack.common import log as logging
Matthew Treinish2324e6b2013-10-21 20:25:17 +000019from tempest.test import attr
20
21
Christian Schwede1acc63a2013-12-27 15:21:32 +000022LOG = logging.getLogger(__name__)
23
24
Matthew Treinish2324e6b2013-10-21 20:25:17 +000025class ExtensionsTestJSON(base.BaseVolumeTest):
26 _interface = 'json'
27
28 @attr(type='gate')
29 def test_list_extensions(self):
30 # List of all extensions
31 resp, extensions = self.volumes_extension_client.list_extensions()
32 self.assertEqual(200, resp.status)
33 if len(self.config.volume_feature_enabled.api_extensions) == 0:
34 raise self.skipException('There are not any extensions configured')
Christian Schwede1acc63a2013-12-27 15:21:32 +000035 extension_list = [extension.get('alias') for extension in extensions]
36 LOG.debug("Cinder extensions: %s" % ','.join(extension_list))
Matthew Treinish2324e6b2013-10-21 20:25:17 +000037 ext = self.config.volume_feature_enabled.api_extensions[0]
38 if ext == 'all':
39 self.assertIn('Hosts', map(lambda x: x['name'], extensions))
40 elif ext:
41 self.assertIn(ext, map(lambda x: x['name'], extensions))
42 else:
43 raise self.skipException('There are not any extensions configured')
44
45
46class ExtensionsTestXML(ExtensionsTestJSON):
47 _interface = 'xml'