Merge "Add test remove plugin from cluster while it enabled"

This commit is contained in:
Jenkins 2016-06-29 12:26:13 +00:00 committed by Gerrit Code Review
commit 393c2cf97e
3 changed files with 51 additions and 1 deletions

View File

@ -2650,6 +2650,21 @@ class FuelWebClient29(object):
attr = self.client.get_cluster_attributes(cluster_id)[section]
return plugin_name in attr
@logwrap
def list_cluster_enabled_plugins(self, cluster_id):
enabled_plugins = []
all_plugins = self.client.plugins_list()
cl_attrib = self.client.get_cluster_attributes(cluster_id)
for plugin in all_plugins:
plugin_name = plugin['name']
if plugin_name in cl_attrib['editable']:
if cl_attrib['editable'][plugin_name]['metadata']['enabled']:
enabled_plugins.append(plugin)
logger.info('{} plugin is enabled '
'in cluster id={}'.format(plugin_name,
cluster_id))
return enabled_plugins
def update_plugin_data(self, cluster_id, plugin_name, data):
attr = self.client.get_cluster_attributes(cluster_id)
# Do not re-upload anything, except selected plugin data

View File

@ -972,3 +972,10 @@ class NailgunClient(object):
'/overrides'.format(env_id=env_id, resource=resource,
node_id=node_id)
return self.client.put(endpoint, data)
@logwrap
@json_parse
def plugins_list(self):
"""Get list of installed plugins"""
endpoint = '/api/plugins'
return self.client.get(endpoint)

View File

@ -146,6 +146,7 @@ class ExamplePlugin(TestBasic):
Duration 35m
Snapshot deploy_ha_one_controller_neutron_example_v3
"""
self.check_run("deploy_ha_one_controller_neutron_example_v3")
checkers.check_plugin_path_env(
var_name='EXAMPLE_PLUGIN_V3_PATH',
plugin_path=EXAMPLE_PLUGIN_V3_PATH
@ -257,7 +258,34 @@ class ExamplePlugin(TestBasic):
)
self.fuel_web.run_ostf(cluster_id=cluster_id)
self.env.make_snapshot("deploy_ha_one_controller_neutron_example_v3")
self.env.make_snapshot("deploy_ha_one_controller_neutron_example_v3",
is_make=True)
@test(depends_on=[deploy_ha_one_controller_neutron_example_v3],
groups=["delete_plugin_enabled_in_cluster"])
@log_snapshot_after_test
def delete_plugin_enabled_in_cluster(self):
"""Try remove plugin enabled in cluster
Scenario:
1. Try to remove plugin from cluster
Duration 3m
"""
self.env.revert_snapshot("deploy_ha_one_controller_neutron_example_v3",
skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
enabled_plugins = self.fuel_web.\
list_cluster_enabled_plugins(cluster_id)
for plugin in enabled_plugins:
self.ssh_manager.execute_on_remote(
ip=self.ssh_manager.admin_ip,
cmd='fuel plugins --remove {0}=={1}'.format(plugin['name'],
plugin['version']),
assert_ec_equal=[1]
)
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
groups=["deploy_neutron_example_ha"])