Merge "Added cli-test for "plugin update""
This commit is contained in:
commit
dadc31e4ba
|
@ -60,6 +60,10 @@ DataProcessingAdditionalGroup = [
|
|||
help='Version of python-saharaclient'),
|
||||
cfg.StrOpt('sahara_url',
|
||||
help='Sahara url as http://ip:port/api_version/tenant_id'),
|
||||
# TODO(shuyingya): Delete this option once the Mitaka release is EOL.
|
||||
cfg.BoolOpt('plugin_update_support',
|
||||
default=True,
|
||||
help='Does sahara support plugin update?'),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
from os import path
|
||||
from os import remove
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from sahara_tempest_plugin.tests.cli import base
|
||||
|
||||
|
@ -60,3 +63,33 @@ class SaharaPluginCLITest(base.ClientTestBase):
|
|||
result = path.exists(configs_file)
|
||||
self.assertTrue(result)
|
||||
remove(configs_file)
|
||||
|
||||
def openstack_plugin_update(self):
|
||||
# check plugin list and 'fake' is available
|
||||
list_plugin = self.listing_result('plugin list')
|
||||
name = [p['Name'] for p in list_plugin]
|
||||
if len(name) == 0:
|
||||
raise self.skipException('No plugin to update')
|
||||
if 'fake' not in name:
|
||||
raise self.skipException('fake plugin is unavailable')
|
||||
|
||||
# update value of "hidden:status" to False
|
||||
update_dict = {'plugin_labels': {'hidden': {'status': False}}}
|
||||
self._update_with_json_file(update_dict)
|
||||
|
||||
# update value and verified it
|
||||
update_dict = {'plugin_labels': {'hidden': {'status': True}}}
|
||||
update_info = self._update_with_json_file(update_dict)
|
||||
update_dict = jsonutils.loads(update_info)
|
||||
self.assertTrue(update_dict['Plugin: hidden'])
|
||||
|
||||
def _update_with_json_file(self, update_dict):
|
||||
update_info = jsonutils.dumps(update_dict)
|
||||
tmp_file = tempfile.mkstemp(suffix='.json')[1]
|
||||
with open(tmp_file, 'w+') as fd:
|
||||
fd.write(update_info)
|
||||
update_result = self.openstack('dataprocessing plugin '
|
||||
'update -f json fake',
|
||||
params=tmp_file)
|
||||
remove(tmp_file)
|
||||
return update_result
|
||||
|
|
|
@ -42,6 +42,8 @@ class Scenario(images.SaharaImageCLITest,
|
|||
self.openstack_plugin_list()
|
||||
self.openstack_plugin_show()
|
||||
self.openstack_plugin_configs_get()
|
||||
if TEMPEST_CONF.data_processing.plugin_update_support:
|
||||
self.openstack_plugin_update()
|
||||
|
||||
def test_node_group_cli(self):
|
||||
master_ngt = self.openstack_node_group_template_create('master', '4')
|
||||
|
|
Loading…
Reference in New Issue