Yaroslav Lobankov | 18544b0 | 2014-04-24 20:17:49 +0400 | [diff] [blame] | 1 | # Copyright (c) 2014 Mirantis Inc. |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 2 | # |
Yaroslav Lobankov | 18544b0 | 2014-04-24 20:17:49 +0400 | [diff] [blame] | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 6 | # |
Yaroslav Lobankov | 18544b0 | 2014-04-24 20:17:49 +0400 | [diff] [blame] | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 8 | # |
Yaroslav Lobankov | 18544b0 | 2014-04-24 20:17:49 +0400 | [diff] [blame] | 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 14 | |
| 15 | from tempest.api.data_processing import base as dp_base |
Luigi Toscano | 14d172d | 2015-01-23 16:37:47 +0100 | [diff] [blame] | 16 | from tempest import config |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 17 | from tempest import test |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 18 | |
Luigi Toscano | 14d172d | 2015-01-23 16:37:47 +0100 | [diff] [blame] | 19 | CONF = config.CONF |
| 20 | |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 21 | |
| 22 | class PluginsTest(dp_base.BaseDataProcessingTest): |
| 23 | def _list_all_plugin_names(self): |
| 24 | """Returns all enabled plugin names. |
| 25 | |
Yaroslav Lobankov | 2f8525e | 2014-07-21 16:40:23 +0400 | [diff] [blame] | 26 | It ensures main plugins availability. |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 27 | """ |
David Kranz | 77f5720 | 2015-02-09 14:10:04 -0500 | [diff] [blame] | 28 | plugins = self.client.list_plugins() |
Yaroslav Lobankov | 89c639f | 2014-04-24 19:36:05 +0400 | [diff] [blame] | 29 | plugins_names = [plugin['name'] for plugin in plugins] |
Luigi Toscano | 14d172d | 2015-01-23 16:37:47 +0100 | [diff] [blame] | 30 | for enabled_plugin in CONF.data_processing_feature_enabled.plugins: |
| 31 | self.assertIn(enabled_plugin, plugins_names) |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 32 | |
| 33 | return plugins_names |
| 34 | |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 35 | @test.attr(type='smoke') |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 36 | def test_plugin_list(self): |
| 37 | self._list_all_plugin_names() |
| 38 | |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 39 | @test.attr(type='smoke') |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 40 | def test_plugin_get(self): |
| 41 | for plugin_name in self._list_all_plugin_names(): |
David Kranz | 77f5720 | 2015-02-09 14:10:04 -0500 | [diff] [blame] | 42 | plugin = self.client.get_plugin(plugin_name) |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 43 | self.assertEqual(plugin_name, plugin['name']) |
| 44 | |
| 45 | for plugin_version in plugin['versions']: |
David Kranz | 77f5720 | 2015-02-09 14:10:04 -0500 | [diff] [blame] | 46 | detailed_plugin = self.client.get_plugin(plugin_name, |
| 47 | plugin_version) |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 48 | self.assertEqual(plugin_name, detailed_plugin['name']) |
| 49 | |
| 50 | # check that required image tags contains name and version |
| 51 | image_tags = detailed_plugin['required_image_tags'] |
| 52 | self.assertIn(plugin_name, image_tags) |
| 53 | self.assertIn(plugin_version, image_tags) |