blob: 8c9b72054a261eff0bf05f855060c3767466c04f [file] [log] [blame]
Yaroslav Lobankov18544b02014-04-24 20:17:49 +04001# Copyright (c) 2014 Mirantis Inc.
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +04002#
Yaroslav Lobankov18544b02014-04-24 20:17:49 +04003# 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 Lukjanovdad26cc2014-02-06 19:58:31 +04006#
Yaroslav Lobankov18544b02014-04-24 20:17:49 +04007# http://www.apache.org/licenses/LICENSE-2.0
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +04008#
Yaroslav Lobankov18544b02014-04-24 20:17:49 +04009# 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 Lukjanovdad26cc2014-02-06 19:58:31 +040014
15from tempest.api.data_processing import base as dp_base
Luigi Toscano14d172d2015-01-23 16:37:47 +010016from tempest import config
Matthew Treinish5c660ab2014-05-18 21:14:36 -040017from tempest import test
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040018
Luigi Toscano14d172d2015-01-23 16:37:47 +010019CONF = config.CONF
20
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040021
22class PluginsTest(dp_base.BaseDataProcessingTest):
23 def _list_all_plugin_names(self):
24 """Returns all enabled plugin names.
25
Yaroslav Lobankov2f8525e2014-07-21 16:40:23 +040026 It ensures main plugins availability.
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040027 """
David Kranz77f57202015-02-09 14:10:04 -050028 plugins = self.client.list_plugins()
Yaroslav Lobankov89c639f2014-04-24 19:36:05 +040029 plugins_names = [plugin['name'] for plugin in plugins]
Luigi Toscano14d172d2015-01-23 16:37:47 +010030 for enabled_plugin in CONF.data_processing_feature_enabled.plugins:
31 self.assertIn(enabled_plugin, plugins_names)
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040032
33 return plugins_names
34
Matthew Treinish5c660ab2014-05-18 21:14:36 -040035 @test.attr(type='smoke')
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040036 def test_plugin_list(self):
37 self._list_all_plugin_names()
38
Matthew Treinish5c660ab2014-05-18 21:14:36 -040039 @test.attr(type='smoke')
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040040 def test_plugin_get(self):
41 for plugin_name in self._list_all_plugin_names():
David Kranz77f57202015-02-09 14:10:04 -050042 plugin = self.client.get_plugin(plugin_name)
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040043 self.assertEqual(plugin_name, plugin['name'])
44
45 for plugin_version in plugin['versions']:
David Kranz77f57202015-02-09 14:10:04 -050046 detailed_plugin = self.client.get_plugin(plugin_name,
47 plugin_version)
Sergey Lukjanovdad26cc2014-02-06 19:58:31 +040048 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)