summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
authorMichal Zegan <m.zegan@samsung.com>2019-06-05 13:10:40 +0200
committerMichal Zegan <m.zegan@samsung.com>2019-06-05 13:17:37 +0200
commit93c4303e07a17cf5882d8d9941d1aea647979115 (patch)
tree52392c41e5a87db925d6b2a5e68031811a1e0db2 /ansible/roles
parent531cb2c7e53e84a5f17846daee510c9d2dc1ff11 (diff)
Add tests for helm role
This adds molecule tests for the helm role. Change-Id: I5be27992062ca9039c141318bc54ce85ce35526b Issue-ID: OOM-1909 Signed-off-by: Michal Zegan <m.zegan@samsung.com>
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/helm/.yamllint11
-rw-r--r--ansible/roles/helm/molecule/default/molecule.yml32
-rw-r--r--ansible/roles/helm/molecule/default/playbook.yml5
-rw-r--r--ansible/roles/helm/molecule/default/prepare.yml5
-rw-r--r--ansible/roles/helm/molecule/default/tests/test_default.py11
5 files changed, 64 insertions, 0 deletions
diff --git a/ansible/roles/helm/.yamllint b/ansible/roles/helm/.yamllint
new file mode 100644
index 00000000..ad0be760
--- /dev/null
+++ b/ansible/roles/helm/.yamllint
@@ -0,0 +1,11 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ truthy: disable
diff --git a/ansible/roles/helm/molecule/default/molecule.yml b/ansible/roles/helm/molecule/default/molecule.yml
new file mode 100644
index 00000000..869f87f6
--- /dev/null
+++ b/ansible/roles/helm/molecule/default/molecule.yml
@@ -0,0 +1,32 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infrastructure-server
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: True
+ privileged: true
+ override_command: False
+ groups:
+ - infrastructure
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ inventory:
+ group_vars:
+ all:
+ app_name: onap
+ app_data_path: "/opt/{{ app_name }}"
+ helm_bin_dir: /usr/local/bin
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/ansible/roles/helm/molecule/default/playbook.yml b/ansible/roles/helm/molecule/default/playbook.yml
new file mode 100644
index 00000000..2705b165
--- /dev/null
+++ b/ansible/roles/helm/molecule/default/playbook.yml
@@ -0,0 +1,5 @@
+---
+- name: Converge
+ hosts: all
+ roles:
+ - helm
diff --git a/ansible/roles/helm/molecule/default/prepare.yml b/ansible/roles/helm/molecule/default/prepare.yml
new file mode 100644
index 00000000..8a149b89
--- /dev/null
+++ b/ansible/roles/helm/molecule/default/prepare.yml
@@ -0,0 +1,5 @@
+---
+- name: Prepare for helm tests
+ hosts: all
+ roles:
+ - prepare-helm
diff --git a/ansible/roles/helm/molecule/default/tests/test_default.py b/ansible/roles/helm/molecule/default/tests/test_default.py
new file mode 100644
index 00000000..2395183b
--- /dev/null
+++ b/ansible/roles/helm/molecule/default/tests/test_default.py
@@ -0,0 +1,11 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_helm(host):
+ assert host.file('/usr/local/bin/helm').exists
+ assert host.run('helm').rc != 127