diff options
author | Hong Guan <hg4105@att.com> | 2019-05-13 13:33:55 -0400 |
---|---|---|
committer | Hong Guan <hg4105@att.com> | 2019-05-13 13:33:55 -0400 |
commit | 906f5e2dc9b12074a12b69cc874056ef4a185dcc (patch) | |
tree | cb08cb20699df60774e894ca9601b8a88855c1be /helm/plugin/tests | |
parent | 0dc5f5a63db8cdacd39dbc3aefa0b22698154e27 (diff) |
Enhance Helm Plugindublin
Change-Id: I82fea00651d726147276e0bba378f3b76ebbd4e6
Issue-ID: CCSDK-1330
Signed-off-by: Hong Guan <hg4105@att.com>
Diffstat (limited to 'helm/plugin/tests')
-rw-r--r-- | helm/plugin/tests/blueprint/blueprint.yaml | 31 | ||||
-rw-r--r-- | helm/plugin/tests/blueprint/plugin/test_plugin.yaml | 42 | ||||
-rw-r--r-- | helm/plugin/tests/test_plugin.py | 34 |
3 files changed, 69 insertions, 38 deletions
diff --git a/helm/plugin/tests/blueprint/blueprint.yaml b/helm/plugin/tests/blueprint/blueprint.yaml index 9636991..9a96910 100644 --- a/helm/plugin/tests/blueprint/blueprint.yaml +++ b/helm/plugin/tests/blueprint/blueprint.yaml @@ -30,6 +30,8 @@ inputs: default: '' config-url: default: '' + config-set: + default: '' config-format: default: 'json' tls-enable: @@ -38,6 +40,12 @@ inputs: config-dir: type: string default: './' + repo-user: + type: string + default: '' + repo-user-password: + type: string + default: '' stable-repo-url: type: string default: 'http://0.0.0.0/stable' @@ -49,21 +57,24 @@ node_templates: # using base cloudify type type: onap.nodes.component properties: - tiller-server-ip: { get_input: tiller-server-ip } - tiller-server-port: { get_input: tiller-server-port } - component-name: test_node - chart-repo-url: { get_input: chart-repo-url } - chart-version: { get_input: chart-version } + tiller_ip: { get_input: tiller-server-ip } + tiller_port: { get_input: tiller-server-port } + component_name: test_node + chart_repo_url: { get_input: chart-repo-url } + chart_version: { get_input: chart-version } namespace: { get_input: namespace } config: { get_input: jsonConfig} - config-url: { get_input: config-url} - config-format: { get_input: config-format} - tls-enable: { get_input: tls-enable} + config_set: { get_input: config-set} + config_url: { get_input: config-url} + repo_user: { get_input: repo-user} + repo_user_password: { get_input: repo-user-password} + config_format: { get_input: config-format} + tls_enable: { get_input: tls-enable} ca: { get_secret: ca_value} cert: { get_secret: cert_value} key: { get_secret: key_value} - config-dir: { get_input: config-dir} - stable-repo-url: { get_input: stable-repo-url} + config_dir: { get_input: config-dir} + stable_repo_url: { get_input: stable-repo-url} outputs: # example output the could be used to simplify assertions by test diff --git a/helm/plugin/tests/blueprint/plugin/test_plugin.yaml b/helm/plugin/tests/blueprint/plugin/test_plugin.yaml index e3b257e..22346a2 100644 --- a/helm/plugin/tests/blueprint/plugin/test_plugin.yaml +++ b/helm/plugin/tests/blueprint/plugin/test_plugin.yaml @@ -26,24 +26,24 @@ node_types: onap.nodes.component: derived_from: cloudify.nodes.Root properties: - tiller-server-ip: + tiller_ip: description: IP of tiller server type: string - tiller-server-port: + tiller_port: default: local description: Port of tiller server type: string - chart-repo-url: + chart_repo_url: default: local description: helm chart repo url type: string - component-name: + component_name: description: onap component string type: string - chart-version: + chart_version: description: helm chart version type: string - config-dir: + config_dir: description: config file dir default: '/opt/manager/resources/' type: string @@ -54,18 +54,22 @@ node_types: description: String format config file type: string default: '' - config-url: + config_set: + description: String format config file + type: string + default: '' + config_url: description: String format config file url type: string default: '' - config-format: + config_format: description: String format config file format type: string default: 'json' - runtime-config: + runtime_config: default: '' description: String format json object. To save the runtime config generate from other nodes. - tls-enable: + tls_enable: description: enable helm TSL type: boolean default: false @@ -81,10 +85,17 @@ node_types: description: value of key.pem type: string default: '' - stable-repo-url: + stable_repo_url: description: URL for stable repository type: string default: 'https://kubernetes-charts.storage.googleapis.com' + repo_user: + type: string + default: '' + repo_user_password: + type: string + default: '' + interfaces: cloudify.interfaces.lifecycle: @@ -101,7 +112,10 @@ workflows: parameters: node_instance_id: description: The id of the node-instance that you want to modify. - config_json: + config_set: + description: The set option string + default: '' + config: description: The changes to the new config json default: '' config_url: @@ -110,9 +124,9 @@ workflows: config_format: description: The config url input format default: 'json' - chartVersion: + chart_version: description: chart version - chartRepo: + chart_repo_url: description: chart repo url rollback: mapping: helm-plugin.plugin.workflows.rollback diff --git a/helm/plugin/tests/test_plugin.py b/helm/plugin/tests/test_plugin.py index 95d9c3f..3dde089 100644 --- a/helm/plugin/tests/test_plugin.py +++ b/helm/plugin/tests/test_plugin.py @@ -125,11 +125,14 @@ class TestPlugin(unittest.TestCase): config_format = 'json' chartVersion = '2.0.0' chartRepo = 'repo' + repo_user = '' + repo_user_passwd = '' try: cfy_local.execute('upgrade', task_retries=0, - parameters={'node_instance_id': node_instance_id, 'config_json': config_json, - 'config_url': config_url, 'config_format': config_format, - 'chartVersion': chartVersion, 'chartRepo': chartRepo}) + parameters={'node_instance_id': node_instance_id, 'config': config_json, + 'config_url': config_url, 'config_format': config_format, + 'chart_version': chartVersion, 'chart_repo_url': chartRepo, + 'repo_user': repo_user, 'repo_user_password': repo_user_passwd}) self.fail('Expected exception due to operation not exist') except Exception as e: self.assertTrue('operation not available') @@ -142,11 +145,11 @@ class TestPlugin(unittest.TestCase): :rollback operation test: """ props = { - 'component-name': 'test_node', + 'component_name': 'test_node', 'namespace': 'onap', - 'tiller-server-port': '8888', - 'tiller-server-ip': '1.1.1.1', - 'tls-enable': 'false' + 'tiller_port': '8888', + 'tiller_ip': '1.1.1.1', + 'tls_enable': 'false' } args = {'revision': '1'} mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', @@ -167,20 +170,23 @@ class TestPlugin(unittest.TestCase): :upgrade operation test: """ props = { - 'component-name': 'test_node', + 'component_name': 'test_node', 'namespace': 'onap', - 'tiller-server-port': '8888', - 'tiller-server-ip': '1.1.1.1', - 'tls-enable': 'false', - 'config-dir': '/tmp' + 'tiller_port': '8888', + 'tiller_ip': '1.1.1.1', + 'tls_enable': 'false', + 'config_dir': '/tmp' } - args = {'revision': '1', 'config': '', 'chart_repo': 'repo', 'chart_version': '2'} + args = {'revision': '1', 'config': '', 'chart_repo': 'repo', 'chart_version': '2', + 'config_set': 'config_set', 'config_json': '', 'config_url': '', + 'config_format': 'format', 'repo_user': '', 'repo_user_passwd': ''} mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', properties=props) try: current_ctx.set(mock_ctx) with mock.patch('plugin.tasks.get_current_helm_value'): with mock.patch('plugin.tasks.get_helm_history'): - plugin.tasks.upgrade(**args) + with mock.patch('plugin.tasks.gen_config_str'): + plugin.tasks.upgrade(**args) finally: current_ctx.clear() |