diff --git a/.ansible-lint b/.ansible-lint index ff64212f..9b67ffad 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -6,6 +6,7 @@ skip_list: - command-instead-of-module # Using command rather than module - galaxy - meta-no-info # meta/main.yml should contain relevant info + - name[template] # Jinja templates should only be at the end of 'name' - risky-shell-pipe # Shells that use pipes should set the pipefail option - unnamed-task # All tasks should be named - var-naming[no-role-prefix] # Variables names from within roles should use role_name_ as a prefix diff --git a/ci/logging_tests_computes.yml b/ci/logging_tests_computes.yml index d520a9c4..399189e6 100644 --- a/ci/logging_tests_computes.yml +++ b/ci/logging_tests_computes.yml @@ -13,5 +13,5 @@ - nova_compute tasks: - name: "Run Telemetry Logging tests" - ansible.builtin.import_role: + ansible.builtin.include_role: name: telemetry_logging diff --git a/ci/logging_tests_controller.yml b/ci/logging_tests_controller.yml index bc666016..e54f1c66 100644 --- a/ci/logging_tests_controller.yml +++ b/ci/logging_tests_controller.yml @@ -25,7 +25,7 @@ - openshift-logging tasks: - name: "Verify logging infrastructure components" - ansible.builtin.import_role: + ansible.builtin.include_role: name: common - name: "Verify logging pods are running in openstack" @@ -43,7 +43,7 @@ - openstackclient tasks: - name: "Verify Running Pods" - ansible.builtin.import_role: + ansible.builtin.include_role: name: common @@ -62,7 +62,7 @@ - loki-operator-controller-manager tasks: - name: "Verify Pods running" - ansible.builtin.import_role: + ansible.builtin.include_role: name: common - name: "Verify logging pods are running in openshift-logging" @@ -91,7 +91,7 @@ ### see JIRA LOG-5431 if pods not running tasks: - name: "Verify Pods running" - ansible.builtin.import_role: + ansible.builtin.include_role: name: common - name: "Verify logging pods are running in minio-dev" @@ -109,7 +109,7 @@ - minio tasks: - name: "Run pod running tests" - ansible.builtin.import_role: + ansible.builtin.include_role: name: common @@ -128,7 +128,7 @@ - logging-edpm-deployment-openstack-edpm-ipam tasks: - name: "Run pods completed tests" - ansible.builtin.import_role: + ansible.builtin.include_role: name: common - name: "Verify the crds exist" @@ -147,5 +147,5 @@ - rulerconfigs.loki.grafana.com tasks: - name: "Run the crds tests" - ansible.builtin.import_role: + ansible.builtin.include_role: name: common diff --git a/roles/common/tasks/container_test.yml b/roles/common/tasks/container_test.yml index 71b84ac5..db219d74 100644 --- a/roles/common/tasks/container_test.yml +++ b/roles/common/tasks/container_test.yml @@ -6,7 +6,9 @@ changed_when: false register: container_status -- name: Verify container status {{ common_container_test_id }} +- name: | + Verify {{ container_name }} container status + {{ common_container_test_id }} ansible.builtin.assert: that: - "'unhealthy' not in container_status.stdout" diff --git a/roles/common/tasks/cr_tests.yml b/roles/common/tasks/cr_tests.yml index fcb646d7..72711edd 100644 --- a/roles/common/tasks/cr_tests.yml +++ b/roles/common/tasks/cr_tests.yml @@ -1,4 +1,7 @@ -- name: Verify that a CR exists {{ common_cr_test_id }} +--- +- name: | + TEST Verify that the {{ item.kind }} {{ item.name }} CR exists + {{ common_cr_test_id }} ansible.builtin.command: cmd: | oc get {{ item.kind }} {{ item.name }} @@ -7,7 +10,9 @@ failed_when: - result.rc != 0 -- name: Verify that a CR is ready {{ common_cr_ready_test_id }} +- name: | + TEST Verify that the {{ item.kind }} {{ item.name }} CR is {{ item.condition_type }} + {{ common_cr_ready_test_id }} ansible.builtin.command: cmd: | oc get {{ item.kind }} {{ item.name }} -o jsonpath='{.status.conditions[?(@.type=="{{ item.condition_type }}")].status}{"\n"}' diff --git a/roles/common/tasks/crd_tests.yml b/roles/common/tasks/crd_tests.yml index e618d204..06615c6b 100644 --- a/roles/common/tasks/crd_tests.yml +++ b/roles/common/tasks/crd_tests.yml @@ -6,9 +6,11 @@ changed_when: false register: output -- name: Verify CRD is found "{{ common_crd_test_id }}" +- name: | + TEST Verify CRD {{ item }} is found + {{ common_crd_test_id }} ansible.builtin.assert: that: - "'NotFound' not in output.stderr" success_msg: "CRD {{ item }} is found." - fail_msg: "CRD {{ item }} not found. Error: {{ output.stderr }}" \ No newline at end of file + fail_msg: "CRD {{ item }} not found. Error: {{ output.stderr }}" diff --git a/roles/common/tasks/endpoint_tests.yml b/roles/common/tasks/endpoint_tests.yml index cdea10ea..de7bac18 100644 --- a/roles/common/tasks/endpoint_tests.yml +++ b/roles/common/tasks/endpoint_tests.yml @@ -6,9 +6,11 @@ changed_when: false register: output -- name: Check that endpoint exist {{ common_endpoint_test_id }} +- name: | + TEST Check that {{ item[0] }} endpoint exists + {{ common_endpoint_test_id }} ansible.builtin.assert: that: - output.stdout != "" success_msg: "The endpoint {{ item[0] }} is found." - fail_msg: "The endpoint for service {{ item[0] }} " \ No newline at end of file + fail_msg: "The endpoint for service {{ item[0] }} " diff --git a/roles/common/tasks/manifest_tests.yml b/roles/common/tasks/manifest_tests.yml index 63e03aa7..48c4ab86 100644 --- a/roles/common/tasks/manifest_tests.yml +++ b/roles/common/tasks/manifest_tests.yml @@ -13,10 +13,12 @@ register: pack_name changed_when: false -- name: Get packagemanifest "{{ common_manifest_test_id }}" +- name: | + TEST Get {{ item }} packagemanifest + {{ common_manifest_test_id }} ansible.builtin.shell: cmd: | oc get packagemanifests | grep "{{ pack_name.stdout }}" | wc -l register: num_found changed_when: false - failed_when: num_expected.stdout != num_found.stdout \ No newline at end of file + failed_when: num_expected.stdout != num_found.stdout diff --git a/roles/common/tasks/pod_tests.yml b/roles/common/tasks/pod_tests.yml index 97e2b5b7..f57fba1c 100644 --- a/roles/common/tasks/pod_tests.yml +++ b/roles/common/tasks/pod_tests.yml @@ -11,7 +11,9 @@ - podinstance.stdout_lines | length != 1 changed_when: false - - name: Check pod {{ common_pod_test_id }} + - name: | + TEST Check {{ item }} pod is running in {{ common_pod_namespace }} namespace + {{ common_pod_test_id }} ansible.builtin.command: cmd: | oc get pod -n "{{ common_pod_nspace }}" "{{ podinstance.stdout }}" diff --git a/roles/common/tasks/project_tests.yml b/roles/common/tasks/project_tests.yml index 1d0be76e..dd5616dc 100644 --- a/roles/common/tasks/project_tests.yml +++ b/roles/common/tasks/project_tests.yml @@ -1,14 +1,16 @@ --- -- name: Verify project "{{ item }}" +- name: Get the {{ item }} project ansible.builtin.shell: cmd: | oc get project "{{ item }}" changed_when: false register: output -- name: Verify project is found "{{ common_project_test_id }}" +- name: | + TEST Verify {{ item }} project exists + {{ common_project_test_id }} ansible.builtin.assert: that: - "'NotFound' not in output.stderr" success_msg: "project {{ item }} is found." - fail_msg: "project {{ item }} not found. Error: {{ output.stderr }}" \ No newline at end of file + fail_msg: "project {{ item }} not found. Error: {{ output.stderr }}" diff --git a/roles/common/tasks/subscription_tests.yml b/roles/common/tasks/subscription_tests.yml index 49f2b6db..7c36f1dd 100644 --- a/roles/common/tasks/subscription_tests.yml +++ b/roles/common/tasks/subscription_tests.yml @@ -6,9 +6,11 @@ changed_when: false register: output -- name: Check that subscription exist {{ common_subscription_test_id }} +- name: | + TEST Check that {{ item }} subscription exists + {{ common_subscription_test_id }} ansible.builtin.assert: that: - "'NotFound' not in output.stderr" success_msg: "subscription {{ item }} is found." - fail_msg: "subscription {{ item }} not found. Error: {{ output.stderr }}" \ No newline at end of file + fail_msg: "subscription {{ item }} not found. Error: {{ output.stderr }}" diff --git a/roles/telemetry_logging/tasks/journal_tests.yml b/roles/telemetry_logging/tasks/journal_tests.yml index 1d27f2a4..cb5e14b6 100644 --- a/roles/telemetry_logging/tasks/journal_tests.yml +++ b/roles/telemetry_logging/tasks/journal_tests.yml @@ -1,6 +1,6 @@ --- - name: | - Get journals {{ item }} + TEST Get journals {{ item }} {{ journal_test_id }} become: true ansible.builtin.shell: