Fix Helm v3 data dir setup 30/117230/5
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Fri, 29 Jan 2021 10:45:55 +0000 (11:45 +0100)
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>
Thu, 4 Feb 2021 08:15:51 +0000 (08:15 +0000)
Verifier test is also added to ensure correct plugin deployment.

Change-Id: I2e43d942f39fc7ecfe34c22d84ba0f59978ec225
Issue-ID: OOM-2665
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
ansible/roles/application/molecule/default/tests/test_default.py
ansible/roles/application/tasks/install-helm3-plugins.yml

index 1bf3624..be9b4cd 100644 (file)
@@ -21,6 +21,7 @@ deploy moleculetestapp local/moleculetestapp --namespace \
 moleculetestapp -f /opt/moleculetestapp/helm_charts/onap/resources/\
 overrides/onap-all.yaml -f /opt/moleculetestapp/override.yaml \
 --timeout 1800"""
+        expected_plugin_path = '/plugins/deploy/deploy.sh'
     elif helm_release == 'v3':
         expected_content = """env
 repo list
@@ -29,7 +30,10 @@ deploy moleculetestapp local/moleculetestapp --namespace \
 moleculetestapp -f /opt/moleculetestapp/helm_charts/onap/resources/\
 overrides/onap-all.yaml -f /opt/moleculetestapp/override.yaml \
 --timeout 1800"""
+        expected_plugin_path = '/root/.local/share/helm/plugins/deploy/' +\
+                               'deploy.sh'
     assert fc == expected_content
+    assert host.file(expected_plugin_path).exists
 
 
 def test_helm_override_file(host):
index da402f3..5d933ed 100644 (file)
@@ -6,12 +6,12 @@
       register: helm_env
     - name: Set helm data dir
       set_fact:
-        helm_data_dir: |
-          "{% if 'HELM_DATA_HOME' in helm_env.stdout %}
+        helm_data_dir:
+          "{% if 'HELM_DATA_HOME' in helm_env.stdout -%}
            {{ (helm_env.stdout | replace('\"', '') | regex_search('HELM_DATA_HOME.*')).split('=')[1] }}
-           {% else %}
+           {%- else -%}
            {{ '~/.local/share/helm' }}
-           {% endif %}"
+           {%- endif %}"
     - name: Ensure that dir for helm plugins exists
       file:
         path: "{{ helm_data_dir }}/plugins"