3 import testinfra.utils.ansible_runner
5 testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
6 os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
9 def test_helm_commands(host):
10 fc = host.file('/tmp/helm_simu_output').content_string.strip()
11 helm_release = host.ansible.get_variables()['helm_version']
12 if helm_release == 'v2':
13 expected_content = """home
14 init --upgrade --skip-refresh
15 version --tiller-connection-timeout 10
19 repo add local http://127.0.0.1:8879
20 deploy moleculetestapp local/moleculetestapp --namespace \
21 moleculetestapp -f /opt/moleculetestapp/helm_charts/onap/resources/\
22 overrides/onap-all.yaml -f /opt/moleculetestapp/override.yaml \
24 expected_plugin_path = '/plugins/deploy/deploy.sh'
25 elif helm_release == 'v3':
26 expected_content = """env
28 repo add local http://127.0.0.1:8879
29 deploy moleculetestapp local/moleculetestapp --namespace \
30 moleculetestapp -f /opt/moleculetestapp/helm_charts/onap/resources/\
31 overrides/onap-all.yaml -f /opt/moleculetestapp/override.yaml \
33 expected_plugin_path = '/root/.local/share/helm/plugins/deploy/' +\
35 assert fc == expected_content
36 assert host.file(expected_plugin_path).exists
39 def test_helm_override_file(host):
40 fc = host.file('/opt/moleculetestapp/override.yaml').content_string.strip()
41 expected_content = """global:
42 cacert: 'this is dummy server certificate value
45 assert fc == expected_content