Savanna: add API client and tests for plugins
Change-Id: I1af1a3e6dbaeec2e1c7a1b9db9fc009822196f9b
This commit is contained in:
parent
037deed40c
commit
dad26cce23
|
@ -0,0 +1,58 @@
|
|||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from tempest.api.data_processing import base as dp_base
|
||||
from tempest.test import attr
|
||||
|
||||
|
||||
class PluginsTest(dp_base.BaseDataProcessingTest):
|
||||
def _list_all_plugin_names(self):
|
||||
"""Returns all enabled plugin names.
|
||||
|
||||
It ensures response status and main plugins availability.
|
||||
"""
|
||||
resp, plugins = self.client.list_plugins()
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
|
||||
plugins_names = list([plugin['name'] for plugin in plugins])
|
||||
self.assertIn('vanilla', plugins_names)
|
||||
self.assertIn('hdp', plugins_names)
|
||||
|
||||
return plugins_names
|
||||
|
||||
@attr(type='smoke')
|
||||
def test_plugin_list(self):
|
||||
self._list_all_plugin_names()
|
||||
|
||||
@attr(type='smoke')
|
||||
def test_plugin_get(self):
|
||||
for plugin_name in self._list_all_plugin_names():
|
||||
resp, plugin = self.client.get_plugin(plugin_name)
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertEqual(plugin_name, plugin['name'])
|
||||
|
||||
for plugin_version in plugin['versions']:
|
||||
resp, detailed_plugin = self.client.get_plugin(plugin_name,
|
||||
plugin_version)
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertEqual(plugin_name, detailed_plugin['name'])
|
||||
|
||||
# check that required image tags contains name and version
|
||||
image_tags = detailed_plugin['required_image_tags']
|
||||
self.assertIn(plugin_name, image_tags)
|
||||
self.assertIn(plugin_version, image_tags)
|
|
@ -77,3 +77,17 @@ class DataProcessingClient(rest_client.RestClient):
|
|||
|
||||
uri = "node-group-templates/%s" % tmpl_id
|
||||
return self.delete(uri)
|
||||
|
||||
def list_plugins(self):
|
||||
"""List all enabled plugins."""
|
||||
|
||||
uri = 'plugins'
|
||||
return self._request_and_parse(self.get, uri, 'plugins')
|
||||
|
||||
def get_plugin(self, plugin_name, plugin_version=None):
|
||||
"""Returns the details of a single plugin."""
|
||||
|
||||
uri = "plugins/%s" % plugin_name
|
||||
if plugin_version:
|
||||
uri += '/%s' % plugin_version
|
||||
return self._request_and_parse(self.get, uri, 'plugin')
|
||||
|
|
Loading…
Reference in New Issue