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