21fc40e4fb820d25051b1489d757f2981395918b
[oom/offline-installer.git] / ansible / roles / application / molecule / default / tests / test_default.py
1 import os
2
3 import testinfra.utils.ansible_runner
4
5 testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
6     os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
7
8
9 def test_helm_commands(host):
10     fc = host.file('/tmp/helm_simu_output').content_string
11     helm_release = host.ansible.get_variables()['helm_version']
12     if helm_release == 'v2':
13         content_str1 = 'home'
14     elif helm_release == 'v3':
15         content_str1 = 'env'
16     expected_content = content_str1 + """
17 init --upgrade --skip-refresh
18 version --tiller-connection-timeout 10
19 repo list
20 serve
21 repo list
22 repo add local http://127.0.0.1:8879
23 install --name moleculetestapp local/moleculetestapp --namespace \
24 moleculetestapp -f /opt/moleculetestapp/helm_charts/onap/resources/\
25 overrides/onap-all.yaml -f /opt/moleculetestapp/override.yaml \
26 --timeout 1800"""
27     assert fc == expected_content
28
29
30 def test_helm_override_file(host):
31     fc = host.file('/opt/moleculetestapp/override.yaml').content_string
32     expected_content = """global:
33     cacert: 'this is dummy server certificate value
34
35         '"""
36     assert fc == expected_content