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 |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 16 | from tempest import test |
Sergey Lukjanov | dad26cc | 2014-02-06 19:58:31 +0400 | [diff] [blame] | 17 | |
| 18 | |
| 19 | class PluginsTest(dp_base.BaseDataProcessingTest): |
| 20 | def _list_all_plugin_names(self): |
| 21 | """Returns all enabled plugin names. |
| 22 | |
| 23 | It ensures response status and main plugins availability. |
| 24 | """ |
| 25 | resp, plugins = self.client.list_plugins() |
| 26 | |
| 27 | self.assertEqual(200, resp.status) |
| 28 | |
| 29 | plugins_names = list([plugin['name'] for plugin in plugins]) |
| 30 | self.assertIn('vanilla', plugins_names) |
| 31 | self.assertIn('hdp', plugins_names) |
| 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(): |
| 42 | resp, plugin = self.client.get_plugin(plugin_name) |
| 43 | |
| 44 | self.assertEqual(200, resp.status) |
| 45 | self.assertEqual(plugin_name, plugin['name']) |
| 46 | |
| 47 | for plugin_version in plugin['versions']: |
| 48 | resp, detailed_plugin = self.client.get_plugin(plugin_name, |
| 49 | plugin_version) |
| 50 | |
| 51 | self.assertEqual(200, resp.status) |
| 52 | self.assertEqual(plugin_name, detailed_plugin['name']) |
| 53 | |
| 54 | # check that required image tags contains name and version |
| 55 | image_tags = detailed_plugin['required_image_tags'] |
| 56 | self.assertIn(plugin_name, image_tags) |
| 57 | self.assertIn(plugin_version, image_tags) |