diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2022-04-11 11:44:32 +0200 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2022-04-19 10:36:02 +0000 |
commit | 8a599cc76686506bb5d0377a2f10f7d7394a67f3 (patch) | |
tree | ccc95727a66cd4f5c872401311863497351ce3ec | |
parent | 7cbde01bcf32d2f9ec16aa76a55a9872522a12e1 (diff) |
[MOLECULE] Setup Molecule for strimzi-kafka-operator role
Change-Id: I71161ec250190babecd092241e586f97fd7bcbca
Issue-ID: OOM-2948
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
7 files changed, 105 insertions, 0 deletions
diff --git a/ansible/roles/strimzi-kafka-operator/.yamllint b/ansible/roles/strimzi-kafka-operator/.yamllint new file mode 100644 index 00000000..c5ae64be --- /dev/null +++ b/ansible/roles/strimzi-kafka-operator/.yamllint @@ -0,0 +1,12 @@ +--- +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/strimzi-kafka-operator/molecule/default/converge.yml b/ansible/roles/strimzi-kafka-operator/molecule/default/converge.yml new file mode 100644 index 00000000..b70400cd --- /dev/null +++ b/ansible/roles/strimzi-kafka-operator/molecule/default/converge.yml @@ -0,0 +1,8 @@ +--- +- name: Converge + hosts: all + pre_tasks: + - name: Include infrastructure group variables + include_vars: ../../../../group_vars/infrastructure.yml + roles: + - strimzi-kafka-operator diff --git a/ansible/roles/strimzi-kafka-operator/molecule/default/molecule.yml b/ansible/roles/strimzi-kafka-operator/molecule/default/molecule.yml new file mode 100644 index 00000000..003267d1 --- /dev/null +++ b/ansible/roles/strimzi-kafka-operator/molecule/default/molecule.yml @@ -0,0 +1,27 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: | + set -e + yamllint . + ansible-lint . + flake8 +platforms: + - name: infrastructure-strimzi-kafka-operator + image: centos:7 + groups: + - infrastructure +provisioner: + name: ansible + env: + ANSIBLE_ROLES_PATH: ../../../../test/roles + ANSIBLE_LIBRARY: ../../../../library + inventory: + group_vars: + all: + app_name: onap + app_data_path: "/opt/{{ app_name }}" +verifier: + name: testinfra diff --git a/ansible/roles/strimzi-kafka-operator/molecule/default/prepare.yml b/ansible/roles/strimzi-kafka-operator/molecule/default/prepare.yml new file mode 100644 index 00000000..34b37f50 --- /dev/null +++ b/ansible/roles/strimzi-kafka-operator/molecule/default/prepare.yml @@ -0,0 +1,10 @@ +--- +- name: Prepare infra container to play strimzi-kafka-operator role + hosts: all + pre_tasks: + - name: Include infrastructure group variables + include_vars: ../../../../group_vars/infrastructure.yml + tasks: + - name: "Include prepare-strimzi-kafka-operator role" + include_role: + name: "prepare-strimzi-kafka-operator" diff --git a/ansible/roles/strimzi-kafka-operator/molecule/default/tests/test_default.py b/ansible/roles/strimzi-kafka-operator/molecule/default/tests/test_default.py new file mode 100644 index 00000000..0a317da4 --- /dev/null +++ b/ansible/roles/strimzi-kafka-operator/molecule/default/tests/test_default.py @@ -0,0 +1,6 @@ +def test_helm_value_file(host): + f = host.file('/opt/onap/strimzi_kafka.yaml') + assert f.exists + assert f.user == 'root' + assert f.group == 'root' + assert f.content_string.strip() == "watchAnyNamespace: true" diff --git a/ansible/roles/strimzi-kafka-operator/molecule/ubuntu/molecule.yml b/ansible/roles/strimzi-kafka-operator/molecule/ubuntu/molecule.yml new file mode 100644 index 00000000..8537ca41 --- /dev/null +++ b/ansible/roles/strimzi-kafka-operator/molecule/ubuntu/molecule.yml @@ -0,0 +1,31 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: | + set -e + yamllint . + ansible-lint . + flake8 +platforms: + - name: infrastructure-ubuntu-strimzi-kafka-operator + image: ubuntu:18.04 + groups: + - infrastructure +provisioner: + name: ansible + env: + ANSIBLE_ROLES_PATH: ../../../../test/roles + ANSIBLE_LIBRARY: ../../../../library + inventory: + group_vars: + all: + app_name: onap + app_data_path: "/opt/{{ app_name }}" + playbooks: + prepare: ../default/prepare.yml + converge: ../default/converge.yml +verifier: + name: testinfra + directory: ../default/tests diff --git a/ansible/test/roles/prepare-strimzi-kafka-operator/tasks/main.yml b/ansible/test/roles/prepare-strimzi-kafka-operator/tasks/main.yml new file mode 100644 index 00000000..435cea21 --- /dev/null +++ b/ansible/test/roles/prepare-strimzi-kafka-operator/tasks/main.yml @@ -0,0 +1,11 @@ +--- +- name: "Ensure {{ app_data_path }}/downloads directory exists" + file: + path: "{{ app_data_path }}/downloads" + recurse: true + state: directory + +- name: "Download strimzi-kafka-operator-helm-3-chart-{{ strimzi_kafka_version }}.tgz" + get_url: + url: "https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.28.0/strimzi-kafka-operator-helm-3-chart-{{ strimzi_kafka_version }}.tgz" + dest: "{{ app_data_path }}/downloads" |