Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 1 | # 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 | |
Doug Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 16 | from oslo_log import log as logging |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 17 | |
| 18 | from tempest.api.volume import base |
Matthew Treinish | 4d352bc | 2014-01-29 18:29:18 +0000 | [diff] [blame] | 19 | from tempest import config |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 20 | from tempest import test |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 21 | |
Matthew Treinish | 4d352bc | 2014-01-29 18:29:18 +0000 | [diff] [blame] | 22 | CONF = config.CONF |
| 23 | |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 24 | |
Christian Schwede | 1acc63a | 2013-12-27 15:21:32 +0000 | [diff] [blame] | 25 | LOG = logging.getLogger(__name__) |
| 26 | |
| 27 | |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 28 | class ExtensionsV2TestJSON(base.BaseVolumeTest): |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 29 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 30 | @test.idempotent_id('94607eb0-43a5-47ca-82aa-736b41bd2e2c') |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 31 | def test_list_extensions(self): |
| 32 | # List of all extensions |
Joseph Lanoux | 6809bab | 2014-12-18 14:57:18 +0000 | [diff] [blame] | 33 | extensions = self.volumes_extension_client.list_extensions() |
Matthew Treinish | 4d352bc | 2014-01-29 18:29:18 +0000 | [diff] [blame] | 34 | if len(CONF.volume_feature_enabled.api_extensions) == 0: |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 35 | raise self.skipException('There are not any extensions configured') |
Christian Schwede | 1acc63a | 2013-12-27 15:21:32 +0000 | [diff] [blame] | 36 | extension_list = [extension.get('alias') for extension in extensions] |
| 37 | LOG.debug("Cinder extensions: %s" % ','.join(extension_list)) |
Matthew Treinish | 4d352bc | 2014-01-29 18:29:18 +0000 | [diff] [blame] | 38 | ext = CONF.volume_feature_enabled.api_extensions[0] |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 39 | if ext == 'all': |
| 40 | self.assertIn('Hosts', map(lambda x: x['name'], extensions)) |
| 41 | elif ext: |
Matthew Treinish | 54176ce | 2014-12-08 21:28:05 +0000 | [diff] [blame] | 42 | self.assertIn(ext, map(lambda x: x['alias'], extensions)) |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 43 | else: |
| 44 | raise self.skipException('There are not any extensions configured') |
| 45 | |
| 46 | |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 47 | class ExtensionsV1TestJSON(ExtensionsV2TestJSON): |
| 48 | _api_version = 1 |