blob: 4fc6ee40f4b77df96148a6eda9d4cead9c1acd99 [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
Matthew Treinish4d352bc2014-01-29 18:29:18 +000018from tempest import config
Christian Schwede1acc63a2013-12-27 15:21:32 +000019from tempest.openstack.common import log as logging
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090020from tempest import test
Matthew Treinish2324e6b2013-10-21 20:25:17 +000021
Matthew Treinish4d352bc2014-01-29 18:29:18 +000022CONF = config.CONF
23
Matthew Treinish2324e6b2013-10-21 20:25:17 +000024
Christian Schwede1acc63a2013-12-27 15:21:32 +000025LOG = logging.getLogger(__name__)
26
27
Zhi Kun Liu53395522014-07-18 16:05:52 +080028class ExtensionsV2TestJSON(base.BaseVolumeTest):
Matthew Treinish2324e6b2013-10-21 20:25:17 +000029
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090030 @test.attr(type='gate')
Matthew Treinish2324e6b2013-10-21 20:25:17 +000031 def test_list_extensions(self):
32 # List of all extensions
Swapnil Kulkarnid9df38c2014-08-16 18:06:52 +000033 _, extensions = self.volumes_extension_client.list_extensions()
Matthew Treinish4d352bc2014-01-29 18:29:18 +000034 if len(CONF.volume_feature_enabled.api_extensions) == 0:
Matthew Treinish2324e6b2013-10-21 20:25:17 +000035 raise self.skipException('There are not any extensions configured')
Christian Schwede1acc63a2013-12-27 15:21:32 +000036 extension_list = [extension.get('alias') for extension in extensions]
37 LOG.debug("Cinder extensions: %s" % ','.join(extension_list))
Matthew Treinish4d352bc2014-01-29 18:29:18 +000038 ext = CONF.volume_feature_enabled.api_extensions[0]
Matthew Treinish2324e6b2013-10-21 20:25:17 +000039 if ext == 'all':
40 self.assertIn('Hosts', map(lambda x: x['name'], extensions))
41 elif ext:
42 self.assertIn(ext, map(lambda x: x['name'], extensions))
43 else:
44 raise self.skipException('There are not any extensions configured')
45
46
Zhi Kun Liu53395522014-07-18 16:05:52 +080047class ExtensionsV2TestXML(ExtensionsV2TestJSON):
48 _interface = 'xml'
49
50
51class ExtensionsV1TestJSON(ExtensionsV2TestJSON):
52 _api_version = 1
53
54
55class ExtensionsV1TestXML(ExtensionsV1TestJSON):
Matthew Treinish2324e6b2013-10-21 20:25:17 +000056 _interface = 'xml'