From 8c98ef2c4bb176bec599a87c7d2a07a94592481b Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:51:41 -0400 Subject: [PATCH 01/64] Create README.md New readme file for role --- roles/qe_common/README.md | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 roles/qe_common/README.md diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md new file mode 100644 index 00000000..f514a549 --- /dev/null +++ b/roles/qe_common/README.md @@ -0,0 +1,58 @@ +qe_common +========= + +The tests in this role are not specific to any one functional area. + +Requirements +------------ + +None + +Role Variables +-------------- + +This role should not have any default variables as this is a common role for tests that can be used for multiple test roles. + +Dependencies +------------ + +None + +Example Playbook +---------------- + +Typically, for this role the tests should *not* use a "main.yml" and import or include all the tests in the role. On the contrary, a tests should explicitly include specific tests needed for a given job. + + hosts: controller + gather_facts: no + vars: + proj_out_file: verify_logging_projects_exist_lresults.log + proj_list: + - openshift-openstack-infra + - openshift + - openstack-operators + - openshift-logging + + tasks: + - name: Remove "{{ proj_out_file }}" + ansible.builtin.file: + path: "{{ proj_out_file }}" + state: absent + changed_when: false + + - name: Verify projects created + ansible.builtin.include_role: + name: qe_common + tasks_from: proj_tests.yml + loop: "{{ proj_list }}" + + +License +------- + +Apache 2 + +Author Information +------------------ + +alexy@redhat.com From 46a758fb818c5d4a9f2592cd6147b0629bb7e0db Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:53:45 -0400 Subject: [PATCH 02/64] Create container_tests.yml new playbook --- roles/qe_common/tasks/container_tests.yml | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 roles/qe_common/tasks/container_tests.yml diff --git a/roles/qe_common/tasks/container_tests.yml b/roles/qe_common/tasks/container_tests.yml new file mode 100644 index 00000000..9ab4f862 --- /dev/null +++ b/roles/qe_common/tasks/container_tests.yml @@ -0,0 +1,27 @@ +--- + +- name: Get container status + ansible.builtin.shell: + cmd: | + podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' + register: container_status + changed_when: false + failed_when: false + +- name: Set status to FAILED + ansible.builtin.set_fact: + t_status: FAILED + +- name: Test Container is Up - "{{ item }}" + ansible.builtin.set_fact: + t_status: PASSED + when: container_status.stdout == "Up" + failed_when: false + +- name: Push result to "{{ container_out_file }}" + ansible.builtin.lineinfile: + path: "{{ container_out_file }}" + line: "{{ inventory_hostname }},{{ item }},{{ t_status }}" + create: yes + mode: '0664' + changed_when: t_status == "FAILED" From 71c049fd9cf0665a8130792ea0400e2795a31560 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:54:59 -0400 Subject: [PATCH 03/64] Adding new playbooks to this testing role --- roles/qe_common/tasks/container_tests.yml | 6 ++- roles/qe_common/tasks/cred_tests.yml | 26 +++++++++++++ roles/qe_common/tasks/credential_tests.yml | 26 +++++++++++++ roles/qe_common/tasks/endpoint_tests.yml | 27 ++++++++++++++ roles/qe_common/tasks/file_tests.yml | 30 +++++++++++++++ roles/qe_common/tasks/manifest_tests.yml | 39 ++++++++++++++++++++ roles/qe_common/tasks/node_tests.yml | 35 ++++++++++++++++++ roles/qe_common/tasks/pod_tests.yml | 36 ++++++++++++++++++ roles/qe_common/tasks/proj_tests.yml | 26 +++++++++++++ roles/qe_common/tasks/subscription_tests.yml | 26 +++++++++++++ 10 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 roles/qe_common/tasks/cred_tests.yml create mode 100644 roles/qe_common/tasks/credential_tests.yml create mode 100644 roles/qe_common/tasks/endpoint_tests.yml create mode 100644 roles/qe_common/tasks/file_tests.yml create mode 100644 roles/qe_common/tasks/manifest_tests.yml create mode 100644 roles/qe_common/tasks/node_tests.yml create mode 100644 roles/qe_common/tasks/pod_tests.yml create mode 100644 roles/qe_common/tasks/proj_tests.yml create mode 100644 roles/qe_common/tasks/subscription_tests.yml diff --git a/roles/qe_common/tasks/container_tests.yml b/roles/qe_common/tasks/container_tests.yml index 9ab4f862..d74ee9d9 100644 --- a/roles/qe_common/tasks/container_tests.yml +++ b/roles/qe_common/tasks/container_tests.yml @@ -10,7 +10,7 @@ - name: Set status to FAILED ansible.builtin.set_fact: - t_status: FAILED + t_status: FAILED - name: Test Container is Up - "{{ item }}" ansible.builtin.set_fact: @@ -22,6 +22,8 @@ ansible.builtin.lineinfile: path: "{{ container_out_file }}" line: "{{ inventory_hostname }},{{ item }},{{ t_status }}" - create: yes + create: yes mode: '0664' changed_when: t_status == "FAILED" + + diff --git a/roles/qe_common/tasks/cred_tests.yml b/roles/qe_common/tasks/cred_tests.yml new file mode 100644 index 00000000..d117584b --- /dev/null +++ b/roles/qe_common/tasks/cred_tests.yml @@ -0,0 +1,26 @@ +--- + +- name: Verify logging credentials "{{ item }}" + ansible.builtin.shell: + cmd: | + oc get crd "{{ item }}" + register: output + changed_when: false + ignore_errors: yes + +- name: Test credential does not exist "{{ item }}" + ansible.builtin.set_fact: + exists: FAILED + +- name: Test credential exists "{{ item }}" + ansible.builtin.set_fact: + exists: PASSED + when: output.rc == 0 + +- name: Push results to "{{ cred_out_file }}" + ansible.builtin.lineinfile: + path: "{{ cred_out_file }}" + line: "credentials,{{ item }},{{ exists }}" + create: yes + mode: '0664' + changed_when: exists == "FAILED" diff --git a/roles/qe_common/tasks/credential_tests.yml b/roles/qe_common/tasks/credential_tests.yml new file mode 100644 index 00000000..890998f1 --- /dev/null +++ b/roles/qe_common/tasks/credential_tests.yml @@ -0,0 +1,26 @@ +--- + +- name: Verify logging credentials "{{ item }}" + ansible.builtin.shell: + cmd: | + oc get crd "{{ item }}" + register: output + changed_when: false + ignore_errors: yes + +- name: Test credential does not exist "{{ item }}" + ansible.builtin.set_fact: + exists: FAILED + +- name: Test credential exists "{{ item }}" + ansible.builtin.set_fact: + exists: PASSED + when: output.rc == 0 + +- name: Push results to "{{ cred_out_file }}" + ansible.builtin.lineinfile: + path: "{{ cred_out_file }}" + line: "credentials,{{ item }},{{ exists }}" + create: yes + mode: '0644' + changed_when: exists == "FAILED" diff --git a/roles/qe_common/tasks/endpoint_tests.yml b/roles/qe_common/tasks/endpoint_tests.yml new file mode 100644 index 00000000..3ebde022 --- /dev/null +++ b/roles/qe_common/tasks/endpoint_tests.yml @@ -0,0 +1,27 @@ +--- + +- name: Get Endpoint + ansible.builtin.shell: + cmd: | + oc project openstack + kubectl exec openstackclient -- openstack endpoint list --service="{{ item[0] }}" --service="{{ item[1] }}" --interface="{{ item[2] }}" + register: result + changed_when: false + ignore_errors: yes + +- name: Set status "{{ item }}" + ansible.builtin.set_fact: + t_status: FAILED + +- name: Set file status to PASSED - "{{ item }}" + ansible.builtin.set_fact: + t_status: PASSED + when: "result.rc == 0" + +- name: Push result to "{{ endpoint_outfile }}" + ansible.builtin.lineinfile: + path: "{{ endpoint_outfile }}" + line: "{{ inventory_hostname }},{{ item[0] }}:{{ item[1] }}:{{ item[2] }},{{ t_status }}" + create: yes + mode: '0644' + changed_when: exists == "FAILED" diff --git a/roles/qe_common/tasks/file_tests.yml b/roles/qe_common/tasks/file_tests.yml new file mode 100644 index 00000000..db73ccbf --- /dev/null +++ b/roles/qe_common/tasks/file_tests.yml @@ -0,0 +1,30 @@ +--- + +- name: Get stats for file + ansible.builtin.stat: + path: "{{ item }}" + register: fstats + changed_when: false + failed_when: false + +- name: Set status "{{ item }}" + ansible.builtin.set_fact: + t_status: FAILED + +- name: Set file status to PASSED - "{{ item }}" + ansible.builtin.set_fact: + t_status: PASSED + when: + - fstats.stat.exists + - fstats.stat.pw_name == "root" + - fstats.stat.isreg + - fstats.stat.size | int >= 300 + failed_when: false + +- name: Push result to "{{ file_exists_outfile }}" + ansible.builtin.lineinfile: + path: "{{ file_exists_outfile }}" + line: "{{ inventory_hostname }},{{ item }},{{ t_status }}" + create: yes + mode: '0644' + changed_when: t_status == "FAILED" diff --git a/roles/qe_common/tasks/manifest_tests.yml b/roles/qe_common/tasks/manifest_tests.yml new file mode 100644 index 00000000..316e2d61 --- /dev/null +++ b/roles/qe_common/tasks/manifest_tests.yml @@ -0,0 +1,39 @@ +--- + +- name: Get number of packages + ansible.builtin.shell: + cmd: | + echo "{{ item }}" | awk '{print $2;}' + register: num_expected + changed_when: false + +- name: Get package name + ansible.builtin.shell: + cmd: | + echo "{{ item }}" | awk '{print $1;}' + register: pack_name + changed_when: false + +- name: Get packagemanifest + ansible.builtin.shell: + cmd: | + oc get packagemanifests | grep "{{ pack_name.stdout }}" | wc -l + register: num_found + changed_when: false + +- name: Set Fail State + ansible.builtin.set_fact: + exists: FAILED + +- name: Set Pass State + ansible.builtin.set_fact: + exists: PASSED + when: num_expected.stdout == num_found.stdout + +- name: Push result to "{{ manifest_out_file }}" + ansible.builtin.lineinfile: + path: "{{ manifest_out_file }}" + line: "{{ pack_name.stdout }},{{ num_found.stdout }},{{ exists }}" + create: yes + mode: '0644' + changed_when: exists == "FAILED" diff --git a/roles/qe_common/tasks/node_tests.yml b/roles/qe_common/tasks/node_tests.yml new file mode 100644 index 00000000..39547765 --- /dev/null +++ b/roles/qe_common/tasks/node_tests.yml @@ -0,0 +1,35 @@ +--- + +- name: Get running node + become: true + ansible.builtin.shell: + cmd: | + virsh list --state-running | grep "{{ item }}" | awk '{print $2;}' + register: nodefound + changed_when: false + +- name: Get node status + become: true + ansible.builtin.shell: + cmd: | + virsh list --state-running | grep "{{ item }}" | awk '{print $3;}' + register: output + changed_when: false + +- name: Set node failed - "{{ item }}" + ansible.builtin.set_fact: + exists: FAILED + +- name: If node exists - "{{ item }}" + ansible.builtin.set_fact: + exists: PASSED + when: output.stdout == "running" + +- name: Push result to "{{ node_out_file }}" + ansible.builtin.lineinfile: + path: "{{ node_out_file }}" + line: "{{ item }},{{ output.stdout }},{{ exists }}" + state: present + create: yes + mode: '0640' + changed_when: exists == "FAILED" diff --git a/roles/qe_common/tasks/pod_tests.yml b/roles/qe_common/tasks/pod_tests.yml new file mode 100644 index 00000000..da3d6f93 --- /dev/null +++ b/roles/qe_common/tasks/pod_tests.yml @@ -0,0 +1,36 @@ +--- + +- name: Get Pod Instance "{{ pod_status_str }}" + ansible.builtin.shell: + cmd: | + oc get pods -n "{{ nspace }}" | grep "{{ item }}" | grep "{{ pod_status_str }}" | awk '{print $1;}' + register: podinstance + changed_when: false + failed_when: false + +- name: Check terminated pod + ansible.builtin.shell: + cmd: | + oc get pod -n "{{ nspace }} {{ podinstance.stdout }}" + register: output + changed_when: false + failed_when: false + +- name: Test pod does not exist - "{{ item }}" + ansible.builtin.set_fact: + exists: FAILED + +- name: Test pod exists - "{{ item }}" + ansible.builtin.set_fact: + exists: PASSED + when: + - output.rc == 0 + - podinstance.stdout != "" + +- name: Push results to "{{ pod_out_file }}" + ansible.builtin.lineinfile: + path: "{{ pod_out_file }}" + line: "pod:{{ item }},{{ podinstance.stdout }},{{ exists }}" + create: yes + mode: '0644' + changed_when: exists == "FAILED" diff --git a/roles/qe_common/tasks/proj_tests.yml b/roles/qe_common/tasks/proj_tests.yml new file mode 100644 index 00000000..85ab1ef1 --- /dev/null +++ b/roles/qe_common/tasks/proj_tests.yml @@ -0,0 +1,26 @@ +--- + +- name: Verify Project exists - "{{ item }}" + ansible.builtin.shell: + cmd: | + oc project "{{ item }}" + register: output + changed_when: false + ignore_errors: yes + +- name: Set exist state to failed - "{{ item }}" + ansible.builtin.set_fact: + exists: FAILED + +- name: Test project exists - "{{ item }}" + ansible.builtin.set_fact: + exists: PASSED + when: output.rc == 0 + +- name: Push results to "{{ proj_out_file }}" + ansible.builtin.lineinfile: + path: "{{ proj_out_file }}" + line: "project,{{ item }},{{ exists }}" + create: yes + mode: '0644' + changed_when: exists == "FAILED" diff --git a/roles/qe_common/tasks/subscription_tests.yml b/roles/qe_common/tasks/subscription_tests.yml new file mode 100644 index 00000000..2b03e053 --- /dev/null +++ b/roles/qe_common/tasks/subscription_tests.yml @@ -0,0 +1,26 @@ +--- + +- name: Verify subscription + ansible.builtin.shell: + cmd: | + oc get subscriptions -n "{{ nspace }}" "{{ item }}" + register: output + changed_when: false + ignore_errors: yes + +- name: Test subscrition does not exist - "{{ item }}" + ansible.builtin.set_fact: + exists: FAILED + +- name: Test subscription exists - "{{ item }}" + ansible.builtin.set_fact: + exists: PASSED + when: output.rc == 0 + +- name: Push result to "{{ subscript_out_file }}" + ansible.builtin.lineinfile: + path: "{{ subscript_out_file }}" + line: "{{ nspace }},{{ item }},{{ exists }}" + create: yes + mode: '0644' + changed_when: exists == "FAILED" From cdae65914940c02a8af520633db645eed11929f9 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:57:26 -0400 Subject: [PATCH 04/64] Delete roles/qe_common/tasks/credential_tests.yml duplicate file --- roles/qe_common/tasks/credential_tests.yml | 26 ---------------------- 1 file changed, 26 deletions(-) delete mode 100644 roles/qe_common/tasks/credential_tests.yml diff --git a/roles/qe_common/tasks/credential_tests.yml b/roles/qe_common/tasks/credential_tests.yml deleted file mode 100644 index 890998f1..00000000 --- a/roles/qe_common/tasks/credential_tests.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- - -- name: Verify logging credentials "{{ item }}" - ansible.builtin.shell: - cmd: | - oc get crd "{{ item }}" - register: output - changed_when: false - ignore_errors: yes - -- name: Test credential does not exist "{{ item }}" - ansible.builtin.set_fact: - exists: FAILED - -- name: Test credential exists "{{ item }}" - ansible.builtin.set_fact: - exists: PASSED - when: output.rc == 0 - -- name: Push results to "{{ cred_out_file }}" - ansible.builtin.lineinfile: - path: "{{ cred_out_file }}" - line: "credentials,{{ item }},{{ exists }}" - create: yes - mode: '0644' - changed_when: exists == "FAILED" From 3dc4358e60c4c9d5f4cb7f4315fe79091378de1d Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 5 Jul 2024 14:03:29 -0400 Subject: [PATCH 05/64] Create service_tests.yml added service test file --- roles/qe_common/tasks/service_tests.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 roles/qe_common/tasks/service_tests.yml diff --git a/roles/qe_common/tasks/service_tests.yml b/roles/qe_common/tasks/service_tests.yml new file mode 100644 index 00000000..a2b96f52 --- /dev/null +++ b/roles/qe_common/tasks/service_tests.yml @@ -0,0 +1,24 @@ +- name: Verify Service Running - "{{ item }}" + ansible.builtin.shell: + cmd: | + oc get service -n "{{ nspace }}" "{{ item }}" + register: output + changed_when: false + ignore_errors: yes + +- name: "Set to failed service - {{ item }}" + ansible.builtin.set_fact: + exists: FAILED + +- name: "If service exists - {{ item }}" + ansible.builtin.set_fact: + exists: PASSED + when: output.rc == 0 + +- name: "Push service check results to {{ services_out_file }}" + ansible.builtin.lineinfile: + path: "{{ services_out_file }}" + line: "Service,{{ item }},{{ exists }}" + create: yes + mode: '0644' + changed_when: exists == "FAILED" From 245c2a1f2b010b2077e5df17821857fc978c73bb Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 5 Jul 2024 14:06:29 -0400 Subject: [PATCH 06/64] Create main.yml added for easy of use --- roles/qe_common/tasks/main.yml | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 roles/qe_common/tasks/main.yml diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml new file mode 100644 index 00000000..51fce7de --- /dev/null +++ b/roles/qe_common/tasks/main.yml @@ -0,0 +1,49 @@ +--- +- name: "{{ container_pol_id }} Verify logging containers exist" + include_tasks: "container_tests.yml" + when: container_pol_id is defined + + +- name: "{{ cred_pol_id }} Verify logging credentials exist" + include_tasks: "cred_tests.yml" + when: cred_pol_id is defined + + +- name: "{{ endpoints_pol_id }} Verify logging endpoints in OSP" + include_tasks: "endpoint_tests.yml" + when: endpoints_pol_id is defined + + +- name: "{{ file_pol_id }} Verify logging credentials exist" + include_tasks: "file_tests.yml" + when: file_pol_id is defined + + +- name: "{{ manifest_pol_id }} Verify logging manifests" + include_tasks: "manifest_tests.yml" + when: manifest_pol_id is defined + + +- name: "{{ node_pol_id }} Verify logging OSP nodes" + include_tasks: node_tests.yml + when: node_pol_id is defined + + +- name: "{{ pod_pol_id }} Verify logging pods" + include_tasks: "pod_tests.yml" + when: pod_pol_id is defined + + +- name: "{{ proj_pol_id }} Verify logging projects exist" + include_tasks: "proj_tests.yml" + when: proj_pol_id is defined + + +- name: "{{ service_pol_id }} Verify logging services" + include_tasks: "service_tests.yml" + when: service_pod_id is defined + + +- name: "{{ subscription_pol_id }} Verify logging subscriptions" + include_tasks: "subscription_tests.yml" + when: subscription_pol_id is defined From f72fd4dd6b201458357d20f81a0b79d668aca326 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 5 Jul 2024 14:08:53 -0400 Subject: [PATCH 07/64] Update main.yml fixed typo --- roles/qe_common/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 51fce7de..3ee12280 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -9,9 +9,9 @@ when: cred_pol_id is defined -- name: "{{ endpoints_pol_id }} Verify logging endpoints in OSP" +- name: "{{ endpoint_pol_id }} Verify logging endpoints in OSP" include_tasks: "endpoint_tests.yml" - when: endpoints_pol_id is defined + when: endpoint_pol_id is defined - name: "{{ file_pol_id }} Verify logging credentials exist" From 2bf3caad3b0601a347e0789a01a4f1b37e59576a Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 09:25:03 -0400 Subject: [PATCH 08/64] Update main.yml --- roles/qe_common/tasks/main.yml | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 3ee12280..162ebb2c 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,49 +1,49 @@ --- -- name: "{{ container_pol_id }} Verify logging containers exist" +- name: "{{ container_data.pol_id }} Verify logging containers exist" include_tasks: "container_tests.yml" - when: container_pol_id is defined + when: container_data is defined -- name: "{{ cred_pol_id }} Verify logging credentials exist" +- name: "{{ cred_data.pol_id }} Verify logging credentials exist" include_tasks: "cred_tests.yml" - when: cred_pol_id is defined + when: cred_data is defined -- name: "{{ endpoint_pol_id }} Verify logging endpoints in OSP" +- name: "{{ endpoint_data.pol_id }} Verify logging endpoints in OSP" include_tasks: "endpoint_tests.yml" - when: endpoint_pol_id is defined + when: endpoint_data is defined -- name: "{{ file_pol_id }} Verify logging credentials exist" +- name: "{{ file_tests_data.pol_id }} Verify logging credentials exist" include_tasks: "file_tests.yml" - when: file_pol_id is defined + when: file_tests_data is defined -- name: "{{ manifest_pol_id }} Verify logging manifests" +- name: "{{ manifest_tests_data.pol_id }} Verify logging manifests" include_tasks: "manifest_tests.yml" - when: manifest_pol_id is defined + when: manifest_tests_data is defined -- name: "{{ node_pol_id }} Verify logging OSP nodes" +- name: "{{ node_tests_data.pol_id }} Verify logging OSP nodes" include_tasks: node_tests.yml - when: node_pol_id is defined + when: node_tests_data is defined -- name: "{{ pod_pol_id }} Verify logging pods" +- name: "{{ pod_tests_data.pol_id }} Verify logging pods" include_tasks: "pod_tests.yml" - when: pod_pol_id is defined + when: pod_tests_data is defined -- name: "{{ proj_pol_id }} Verify logging projects exist" +- name: "{{ proj_tests_data.pol_id }} Verify logging projects exist" include_tasks: "proj_tests.yml" - when: proj_pol_id is defined + when: proj_tests_data is defined -- name: "{{ service_pol_id }} Verify logging services" +- name: "{{ service_tests_data.pol_id }} Verify logging services" include_tasks: "service_tests.yml" - when: service_pod_id is defined + when: service_tests_data is defined -- name: "{{ subscription_pol_id }} Verify logging subscriptions" +- name: "{{ subscription_tests_data.pol_id }} Verify logging subscriptions" include_tasks: "subscription_tests.yml" - when: subscription_pol_id is defined + when: subscription_tests_data is defined From 76c49d25ad574d1a3252332b03ff7a2da607dec9 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:27:53 -0400 Subject: [PATCH 09/64] Update container_tests.yml removed redundant results file generation --- roles/qe_common/tasks/container_tests.yml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/roles/qe_common/tasks/container_tests.yml b/roles/qe_common/tasks/container_tests.yml index d74ee9d9..ae8c888b 100644 --- a/roles/qe_common/tasks/container_tests.yml +++ b/roles/qe_common/tasks/container_tests.yml @@ -7,23 +7,3 @@ register: container_status changed_when: false failed_when: false - -- name: Set status to FAILED - ansible.builtin.set_fact: - t_status: FAILED - -- name: Test Container is Up - "{{ item }}" - ansible.builtin.set_fact: - t_status: PASSED - when: container_status.stdout == "Up" - failed_when: false - -- name: Push result to "{{ container_out_file }}" - ansible.builtin.lineinfile: - path: "{{ container_out_file }}" - line: "{{ inventory_hostname }},{{ item }},{{ t_status }}" - create: yes - mode: '0664' - changed_when: t_status == "FAILED" - - From 37fa0d9cd11fc79fc21c22deee76ea1db035ce05 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:29:14 -0400 Subject: [PATCH 10/64] Update cred_tests.yml remove redundant results file generation --- roles/qe_common/tasks/cred_tests.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/roles/qe_common/tasks/cred_tests.yml b/roles/qe_common/tasks/cred_tests.yml index d117584b..74ae598b 100644 --- a/roles/qe_common/tasks/cred_tests.yml +++ b/roles/qe_common/tasks/cred_tests.yml @@ -7,20 +7,3 @@ register: output changed_when: false ignore_errors: yes - -- name: Test credential does not exist "{{ item }}" - ansible.builtin.set_fact: - exists: FAILED - -- name: Test credential exists "{{ item }}" - ansible.builtin.set_fact: - exists: PASSED - when: output.rc == 0 - -- name: Push results to "{{ cred_out_file }}" - ansible.builtin.lineinfile: - path: "{{ cred_out_file }}" - line: "credentials,{{ item }},{{ exists }}" - create: yes - mode: '0664' - changed_when: exists == "FAILED" From da302a452ddc84c123483fc1bf7f04b2ddf2c7b1 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:31:31 -0400 Subject: [PATCH 11/64] Update container_tests.yml remove redundant results file generation. --- roles/qe_common/tasks/container_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/tasks/container_tests.yml b/roles/qe_common/tasks/container_tests.yml index ae8c888b..fbb525f1 100644 --- a/roles/qe_common/tasks/container_tests.yml +++ b/roles/qe_common/tasks/container_tests.yml @@ -6,4 +6,4 @@ podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' register: container_status changed_when: false - failed_when: false + ignore_errors: yes From 02e3e3152137855146772e77d999f63dca033930 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:33:06 -0400 Subject: [PATCH 12/64] Update endpoint_tests.yml remove redundant results file generation. --- roles/qe_common/tasks/endpoint_tests.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/roles/qe_common/tasks/endpoint_tests.yml b/roles/qe_common/tasks/endpoint_tests.yml index 3ebde022..b225d85d 100644 --- a/roles/qe_common/tasks/endpoint_tests.yml +++ b/roles/qe_common/tasks/endpoint_tests.yml @@ -8,20 +8,3 @@ register: result changed_when: false ignore_errors: yes - -- name: Set status "{{ item }}" - ansible.builtin.set_fact: - t_status: FAILED - -- name: Set file status to PASSED - "{{ item }}" - ansible.builtin.set_fact: - t_status: PASSED - when: "result.rc == 0" - -- name: Push result to "{{ endpoint_outfile }}" - ansible.builtin.lineinfile: - path: "{{ endpoint_outfile }}" - line: "{{ inventory_hostname }},{{ item[0] }}:{{ item[1] }}:{{ item[2] }},{{ t_status }}" - create: yes - mode: '0644' - changed_when: exists == "FAILED" From 904235b7e693a40157877883f5aec3ee4336bd3e Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:34:00 -0400 Subject: [PATCH 13/64] Update file_tests.yml remove redundant results file generation. --- roles/qe_common/tasks/file_tests.yml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/roles/qe_common/tasks/file_tests.yml b/roles/qe_common/tasks/file_tests.yml index db73ccbf..2ddb3abf 100644 --- a/roles/qe_common/tasks/file_tests.yml +++ b/roles/qe_common/tasks/file_tests.yml @@ -5,26 +5,5 @@ path: "{{ item }}" register: fstats changed_when: false - failed_when: false + ignore_errors: true -- name: Set status "{{ item }}" - ansible.builtin.set_fact: - t_status: FAILED - -- name: Set file status to PASSED - "{{ item }}" - ansible.builtin.set_fact: - t_status: PASSED - when: - - fstats.stat.exists - - fstats.stat.pw_name == "root" - - fstats.stat.isreg - - fstats.stat.size | int >= 300 - failed_when: false - -- name: Push result to "{{ file_exists_outfile }}" - ansible.builtin.lineinfile: - path: "{{ file_exists_outfile }}" - line: "{{ inventory_hostname }},{{ item }},{{ t_status }}" - create: yes - mode: '0644' - changed_when: t_status == "FAILED" From f15fcb8988fcb425fee38e1315754a3cdeab20d5 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:35:40 -0400 Subject: [PATCH 14/64] Update manifest_tests.yml remove redundant results file generation. --- roles/qe_common/tasks/manifest_tests.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/roles/qe_common/tasks/manifest_tests.yml b/roles/qe_common/tasks/manifest_tests.yml index 316e2d61..32699fe9 100644 --- a/roles/qe_common/tasks/manifest_tests.yml +++ b/roles/qe_common/tasks/manifest_tests.yml @@ -20,20 +20,4 @@ oc get packagemanifests | grep "{{ pack_name.stdout }}" | wc -l register: num_found changed_when: false - -- name: Set Fail State - ansible.builtin.set_fact: - exists: FAILED - -- name: Set Pass State - ansible.builtin.set_fact: - exists: PASSED - when: num_expected.stdout == num_found.stdout - -- name: Push result to "{{ manifest_out_file }}" - ansible.builtin.lineinfile: - path: "{{ manifest_out_file }}" - line: "{{ pack_name.stdout }},{{ num_found.stdout }},{{ exists }}" - create: yes - mode: '0644' - changed_when: exists == "FAILED" + ignore_errors: true From 9cdb01eee553b7c5cddd15fdef43b33959c0d11b Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:36:56 -0400 Subject: [PATCH 15/64] Update node_tests.yml remove redundant results file generation --- roles/qe_common/tasks/node_tests.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/roles/qe_common/tasks/node_tests.yml b/roles/qe_common/tasks/node_tests.yml index 39547765..d02e9668 100644 --- a/roles/qe_common/tasks/node_tests.yml +++ b/roles/qe_common/tasks/node_tests.yml @@ -15,21 +15,4 @@ virsh list --state-running | grep "{{ item }}" | awk '{print $3;}' register: output changed_when: false - -- name: Set node failed - "{{ item }}" - ansible.builtin.set_fact: - exists: FAILED - -- name: If node exists - "{{ item }}" - ansible.builtin.set_fact: - exists: PASSED - when: output.stdout == "running" - -- name: Push result to "{{ node_out_file }}" - ansible.builtin.lineinfile: - path: "{{ node_out_file }}" - line: "{{ item }},{{ output.stdout }},{{ exists }}" - state: present - create: yes - mode: '0640' - changed_when: exists == "FAILED" + ignore_errors: true From f024c301b27ab95cb6619d2ce3d662645cb203df Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:38:50 -0400 Subject: [PATCH 16/64] Update pod_tests.yml remove redundant results file generation --- roles/qe_common/tasks/pod_tests.yml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/roles/qe_common/tasks/pod_tests.yml b/roles/qe_common/tasks/pod_tests.yml index da3d6f93..7a38d7f1 100644 --- a/roles/qe_common/tasks/pod_tests.yml +++ b/roles/qe_common/tasks/pod_tests.yml @@ -15,22 +15,3 @@ register: output changed_when: false failed_when: false - -- name: Test pod does not exist - "{{ item }}" - ansible.builtin.set_fact: - exists: FAILED - -- name: Test pod exists - "{{ item }}" - ansible.builtin.set_fact: - exists: PASSED - when: - - output.rc == 0 - - podinstance.stdout != "" - -- name: Push results to "{{ pod_out_file }}" - ansible.builtin.lineinfile: - path: "{{ pod_out_file }}" - line: "pod:{{ item }},{{ podinstance.stdout }},{{ exists }}" - create: yes - mode: '0644' - changed_when: exists == "FAILED" From 3e339ebf26e1ce95c1066fd984741e60f242c0ab Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:39:32 -0400 Subject: [PATCH 17/64] Update proj_tests.yml remove redundant results file generation --- roles/qe_common/tasks/proj_tests.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/roles/qe_common/tasks/proj_tests.yml b/roles/qe_common/tasks/proj_tests.yml index 85ab1ef1..bd9a847d 100644 --- a/roles/qe_common/tasks/proj_tests.yml +++ b/roles/qe_common/tasks/proj_tests.yml @@ -8,19 +8,3 @@ changed_when: false ignore_errors: yes -- name: Set exist state to failed - "{{ item }}" - ansible.builtin.set_fact: - exists: FAILED - -- name: Test project exists - "{{ item }}" - ansible.builtin.set_fact: - exists: PASSED - when: output.rc == 0 - -- name: Push results to "{{ proj_out_file }}" - ansible.builtin.lineinfile: - path: "{{ proj_out_file }}" - line: "project,{{ item }},{{ exists }}" - create: yes - mode: '0644' - changed_when: exists == "FAILED" From 66c3cae9927241acfbc2caefe3660af656206c36 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:39:59 -0400 Subject: [PATCH 18/64] Update service_tests.yml --- roles/qe_common/tasks/service_tests.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/roles/qe_common/tasks/service_tests.yml b/roles/qe_common/tasks/service_tests.yml index a2b96f52..7d588532 100644 --- a/roles/qe_common/tasks/service_tests.yml +++ b/roles/qe_common/tasks/service_tests.yml @@ -5,20 +5,3 @@ register: output changed_when: false ignore_errors: yes - -- name: "Set to failed service - {{ item }}" - ansible.builtin.set_fact: - exists: FAILED - -- name: "If service exists - {{ item }}" - ansible.builtin.set_fact: - exists: PASSED - when: output.rc == 0 - -- name: "Push service check results to {{ services_out_file }}" - ansible.builtin.lineinfile: - path: "{{ services_out_file }}" - line: "Service,{{ item }},{{ exists }}" - create: yes - mode: '0644' - changed_when: exists == "FAILED" From 822132cc286a2a45fe38f951122d5bb747987655 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:40:37 -0400 Subject: [PATCH 19/64] Update subscription_tests.yml remove redundant results file generation --- roles/qe_common/tasks/subscription_tests.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/roles/qe_common/tasks/subscription_tests.yml b/roles/qe_common/tasks/subscription_tests.yml index 2b03e053..2cddf933 100644 --- a/roles/qe_common/tasks/subscription_tests.yml +++ b/roles/qe_common/tasks/subscription_tests.yml @@ -7,20 +7,3 @@ register: output changed_when: false ignore_errors: yes - -- name: Test subscrition does not exist - "{{ item }}" - ansible.builtin.set_fact: - exists: FAILED - -- name: Test subscription exists - "{{ item }}" - ansible.builtin.set_fact: - exists: PASSED - when: output.rc == 0 - -- name: Push result to "{{ subscript_out_file }}" - ansible.builtin.lineinfile: - path: "{{ subscript_out_file }}" - line: "{{ nspace }},{{ item }},{{ exists }}" - create: yes - mode: '0644' - changed_when: exists == "FAILED" From 9afdba54548cdfd31ed1862242d2223391e0c582 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:26:41 -0400 Subject: [PATCH 20/64] Update container_tests.yml set fail_when --- roles/qe_common/tasks/container_tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/container_tests.yml b/roles/qe_common/tasks/container_tests.yml index fbb525f1..ff8e0fe8 100644 --- a/roles/qe_common/tasks/container_tests.yml +++ b/roles/qe_common/tasks/container_tests.yml @@ -5,5 +5,4 @@ cmd: | podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' register: container_status - changed_when: false - ignore_errors: yes + failed_when: container_status.stdout != "Up" From 3c5da9dccf88c99ba77dbc424557772ba648bef9 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:28:05 -0400 Subject: [PATCH 21/64] Update cred_tests.yml added failed_when --- roles/qe_common/tasks/cred_tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/cred_tests.yml b/roles/qe_common/tasks/cred_tests.yml index 74ae598b..1305bf7e 100644 --- a/roles/qe_common/tasks/cred_tests.yml +++ b/roles/qe_common/tasks/cred_tests.yml @@ -5,5 +5,4 @@ cmd: | oc get crd "{{ item }}" register: output - changed_when: false - ignore_errors: yes + failed_when: output.rc != 0 From 083b4cf3ec90f68d9851f1cabce2134a534a39fb Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:29:08 -0400 Subject: [PATCH 22/64] Update endpoint_tests.yml added failed_when --- roles/qe_common/tasks/endpoint_tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/endpoint_tests.yml b/roles/qe_common/tasks/endpoint_tests.yml index b225d85d..10c7a578 100644 --- a/roles/qe_common/tasks/endpoint_tests.yml +++ b/roles/qe_common/tasks/endpoint_tests.yml @@ -6,5 +6,4 @@ oc project openstack kubectl exec openstackclient -- openstack endpoint list --service="{{ item[0] }}" --service="{{ item[1] }}" --interface="{{ item[2] }}" register: result - changed_when: false - ignore_errors: yes + failed_when: result.rc != 0 From 33f737c35c3ea0b4787c891cd7c7e4da995d94e8 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:47:58 -0400 Subject: [PATCH 23/64] Update file_tests.yml added failed_when conditions --- roles/qe_common/tasks/file_tests.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/file_tests.yml b/roles/qe_common/tasks/file_tests.yml index 2ddb3abf..275519bf 100644 --- a/roles/qe_common/tasks/file_tests.yml +++ b/roles/qe_common/tasks/file_tests.yml @@ -4,6 +4,9 @@ ansible.builtin.stat: path: "{{ item }}" register: fstats - changed_when: false - ignore_errors: true + failed_when: + - fstats.stat.pw_name != "root" + - fstats.stat.size | int < 300 + - not fstats.stat.exists + - not fstats.stat.isreg From 3469919569aba34a04048bde2be0c2d284963f8a Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:58:13 -0400 Subject: [PATCH 24/64] Update manifest_tests.yml added failed_when --- roles/qe_common/tasks/manifest_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/tasks/manifest_tests.yml b/roles/qe_common/tasks/manifest_tests.yml index 32699fe9..1dbb3ed0 100644 --- a/roles/qe_common/tasks/manifest_tests.yml +++ b/roles/qe_common/tasks/manifest_tests.yml @@ -20,4 +20,4 @@ oc get packagemanifests | grep "{{ pack_name.stdout }}" | wc -l register: num_found changed_when: false - ignore_errors: true + failed_when: num_expected.stdout != num_found.stdout From 139e9bc9b0d304127e6372f201b4f3cf6d043d5a Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:59:51 -0400 Subject: [PATCH 25/64] Update node_tests.yml added failed_when --- roles/qe_common/tasks/node_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/tasks/node_tests.yml b/roles/qe_common/tasks/node_tests.yml index d02e9668..ac0f751c 100644 --- a/roles/qe_common/tasks/node_tests.yml +++ b/roles/qe_common/tasks/node_tests.yml @@ -15,4 +15,4 @@ virsh list --state-running | grep "{{ item }}" | awk '{print $3;}' register: output changed_when: false - ignore_errors: true + failed_when: output.stdout != "running" From 67efe0d0c13aa563199c638e0d7a67a9f63ec13a Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:02:24 -0400 Subject: [PATCH 26/64] Update pod_tests.yml added failed_when --- roles/qe_common/tasks/pod_tests.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/pod_tests.yml b/roles/qe_common/tasks/pod_tests.yml index 7a38d7f1..784d9281 100644 --- a/roles/qe_common/tasks/pod_tests.yml +++ b/roles/qe_common/tasks/pod_tests.yml @@ -6,7 +6,6 @@ oc get pods -n "{{ nspace }}" | grep "{{ item }}" | grep "{{ pod_status_str }}" | awk '{print $1;}' register: podinstance changed_when: false - failed_when: false - name: Check terminated pod ansible.builtin.shell: @@ -14,4 +13,8 @@ oc get pod -n "{{ nspace }} {{ podinstance.stdout }}" register: output changed_when: false - failed_when: false + failed_when: + - output.rc != 0 + - podinstance.stdout == "" + + From 36f184ab2866b74533b076e0e65273570e3583b5 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:05:02 -0400 Subject: [PATCH 27/64] Update proj_tests.yml added failed_when --- roles/qe_common/tasks/proj_tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/proj_tests.yml b/roles/qe_common/tasks/proj_tests.yml index bd9a847d..b852ac02 100644 --- a/roles/qe_common/tasks/proj_tests.yml +++ b/roles/qe_common/tasks/proj_tests.yml @@ -6,5 +6,4 @@ oc project "{{ item }}" register: output changed_when: false - ignore_errors: yes - + failed_when: output.rc != 0 From 26ce39136d83d3095c001fc28f5dcef7aa67b84f Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:07:10 -0400 Subject: [PATCH 28/64] Update service_tests.yml added failed_when --- roles/qe_common/tasks/service_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/tasks/service_tests.yml b/roles/qe_common/tasks/service_tests.yml index 7d588532..8a60c243 100644 --- a/roles/qe_common/tasks/service_tests.yml +++ b/roles/qe_common/tasks/service_tests.yml @@ -4,4 +4,4 @@ oc get service -n "{{ nspace }}" "{{ item }}" register: output changed_when: false - ignore_errors: yes + failed_when: output.rc != 0 From 695124590037ac64ab32d4475e59f9c1c3de9f4f Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:08:08 -0400 Subject: [PATCH 29/64] Update subscription_tests.yml added failed_when --- roles/qe_common/tasks/subscription_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/tasks/subscription_tests.yml b/roles/qe_common/tasks/subscription_tests.yml index 2cddf933..d19a5908 100644 --- a/roles/qe_common/tasks/subscription_tests.yml +++ b/roles/qe_common/tasks/subscription_tests.yml @@ -6,4 +6,4 @@ oc get subscriptions -n "{{ nspace }}" "{{ item }}" register: output changed_when: false - ignore_errors: yes + failed_when: output.rc != 0 From 72393344e12e982ca05db1fbd788fb1d4d39b1f6 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:18:19 -0400 Subject: [PATCH 30/64] Update main.yml conditional includes updated --- roles/qe_common/tasks/main.yml | 45 +++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 162ebb2c..c8be1fd4 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,49 +1,54 @@ --- -- name: "{{ container_data.pol_id }} Verify logging containers exist" +- name: "Verify container" include_tasks: "container_tests.yml" - when: container_data is defined + when: container_list is defined -- name: "{{ cred_data.pol_id }} Verify logging credentials exist" +- name: "Verify credential" include_tasks: "cred_tests.yml" - when: cred_data is defined + when: cred_list is defined -- name: "{{ endpoint_data.pol_id }} Verify logging endpoints in OSP" +- name: "Verify endpoint in OSP" include_tasks: "endpoint_tests.yml" - when: endpoint_data is defined + when: endpoint_list is defined -- name: "{{ file_tests_data.pol_id }} Verify logging credentials exist" +- name: "Verify file" include_tasks: "file_tests.yml" - when: file_tests_data is defined + when: file_list is defined -- name: "{{ manifest_tests_data.pol_id }} Verify logging manifests" +- name: "Verify manifest" include_tasks: "manifest_tests.yml" - when: manifest_tests_data is defined + when: manifest_list is defined -- name: "{{ node_tests_data.pol_id }} Verify logging OSP nodes" +- name: "Verify OSP node" include_tasks: node_tests.yml - when: node_tests_data is defined + when: node_list is defined -- name: "{{ pod_tests_data.pol_id }} Verify logging pods" +- name: "Verify pod" include_tasks: "pod_tests.yml" - when: pod_tests_data is defined + when: + - pod_list is defined + - nspace is defined + - pod_status_str is defined -- name: "{{ proj_tests_data.pol_id }} Verify logging projects exist" +- name: "Verify project" include_tasks: "proj_tests.yml" - when: proj_tests_data is defined + when: proj_list is defined -- name: "{{ service_tests_data.pol_id }} Verify logging services" +- name: "Verify service" include_tasks: "service_tests.yml" - when: service_tests_data is defined + when: + - service_list is defined + - nspace is defined -- name: "{{ subscription_tests_data.pol_id }} Verify logging subscriptions" +- name: "Verify subscription" include_tasks: "subscription_tests.yml" - when: subscription_tests_data is defined + when: subscription_list is defined From b5997efa8a4e3b1ba3dc3b9c3eaec3a5bfac4824 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:30:04 -0400 Subject: [PATCH 31/64] Update main.yml adding ansible.builtin .... --- roles/qe_common/tasks/main.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index c8be1fd4..52710f74 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,36 +1,36 @@ --- - name: "Verify container" - include_tasks: "container_tests.yml" + ansible.builtin.include_tasks: "container_tests.yml" when: container_list is defined - name: "Verify credential" - include_tasks: "cred_tests.yml" + ansible.builtin.include_tasks: "cred_tests.yml" when: cred_list is defined - name: "Verify endpoint in OSP" - include_tasks: "endpoint_tests.yml" + ansible.builtin.include_tasks: "endpoint_tests.yml" when: endpoint_list is defined - name: "Verify file" - include_tasks: "file_tests.yml" + ansible.builtin.include_tasks: "file_tests.yml" when: file_list is defined - name: "Verify manifest" - include_tasks: "manifest_tests.yml" + ansible.builtin.include_tasks: "manifest_tests.yml" when: manifest_list is defined - name: "Verify OSP node" - include_tasks: node_tests.yml + ansible.builtin.include_tasks: node_tests.yml when: node_list is defined - name: "Verify pod" - include_tasks: "pod_tests.yml" + ansible.builtin.include_tasks: "pod_tests.yml" when: - pod_list is defined - nspace is defined @@ -38,17 +38,17 @@ - name: "Verify project" - include_tasks: "proj_tests.yml" + ansible.builtin.include_tasks: "proj_tests.yml" when: proj_list is defined - name: "Verify service" - include_tasks: "service_tests.yml" + ansible.builtin.include_tasks: "service_tests.yml" when: - service_list is defined - nspace is defined - name: "Verify subscription" - include_tasks: "subscription_tests.yml" + ansible.builtin.include_tasks: "subscription_tests.yml" when: subscription_list is defined From f8557fd08e2b7eb66b164b2a0cfcbcb414316c77 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:32:15 -0400 Subject: [PATCH 32/64] Update .ansible-lint adding exclude_path(s) --- .ansible-lint | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ansible-lint b/.ansible-lint index ff64212f..79c620d4 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -2,6 +2,8 @@ exclude_paths: - ci/ - roles/telemetry_autoscaling + - roles/telemetry_logging + - roles/qe_common skip_list: - command-instead-of-module # Using command rather than module - galaxy From fdc11fc2fe6a8d7baf44f73ae145f3efc9212af3 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:18:21 -0400 Subject: [PATCH 33/64] Update main.yml Made style more consistent --- roles/qe_common/tasks/main.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 52710f74..66ea66e4 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,32 +1,38 @@ --- - name: "Verify container" ansible.builtin.include_tasks: "container_tests.yml" - when: container_list is defined + when: + - container_list is defined - name: "Verify credential" ansible.builtin.include_tasks: "cred_tests.yml" - when: cred_list is defined + when: + - cred_list is defined - name: "Verify endpoint in OSP" ansible.builtin.include_tasks: "endpoint_tests.yml" - when: endpoint_list is defined + when: + - endpoint_list is defined - name: "Verify file" ansible.builtin.include_tasks: "file_tests.yml" - when: file_list is defined + when: + - file_list is defined - name: "Verify manifest" ansible.builtin.include_tasks: "manifest_tests.yml" - when: manifest_list is defined + when: + - manifest_list is defined - name: "Verify OSP node" ansible.builtin.include_tasks: node_tests.yml - when: node_list is defined + when: + - node_list is defined - name: "Verify pod" @@ -39,7 +45,8 @@ - name: "Verify project" ansible.builtin.include_tasks: "proj_tests.yml" - when: proj_list is defined + when: + - proj_list is defined - name: "Verify service" @@ -51,4 +58,5 @@ - name: "Verify subscription" ansible.builtin.include_tasks: "subscription_tests.yml" - when: subscription_list is defined + when: + - subscription_list is defined From 23ef3d7478ab6fbbe3576ea294cf7bc27dda4e1b Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:50:17 -0400 Subject: [PATCH 34/64] Update README.md added vars to document --- roles/qe_common/README.md | 45 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md index f514a549..5995bb44 100644 --- a/roles/qe_common/README.md +++ b/roles/qe_common/README.md @@ -1,7 +1,7 @@ qe_common ========= -The tests in this role are not specific to any one functional area. +The tests in this role are not specific to any one functional area but are an aggregate of common tests that can be used in all OSP 18.0/OCP jobs. Requirements ------------ @@ -10,8 +10,49 @@ None Role Variables -------------- +Variable required for all tasks to run: + + For cred_tests.yml tasks: + cred_list: + - list of credentials to validate + + For endpoint_tests.yml tasks: + endpoint_list: + - list of endpoints to validate + + For node_tests.yml tasks: + node_list: + - list of nodes to validate + + For proj_test.yml tasks: + proj_list: + - list of projects to validate + + For pod_tests.yml tasks: + pod_list: + - list of pods to validate + pod_status_str: + - status of pods to check + pod_nspace: + - list of projects where pods exist + + For service_tests.yml tasks: + service_list: + - list of services to validate + service_nspace: + - project where services are running + + For manifest_tests.yml tasks: + manifest_list: + - list of package manifests to validate + + For subscription_tests.yml tasks: + subscription_list: + - list of subscriptions to validate + subscription_nspace: + - project where the subscription lives + -This role should not have any default variables as this is a common role for tests that can be used for multiple test roles. Dependencies ------------ From 5e84642863832ce3cb1440c0becfddeaf0e4ec56 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:51:35 -0400 Subject: [PATCH 35/64] Update README.md fixed formating --- roles/qe_common/README.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md index 5995bb44..d608b162 100644 --- a/roles/qe_common/README.md +++ b/roles/qe_common/README.md @@ -13,47 +13,46 @@ Role Variables Variable required for all tasks to run: For cred_tests.yml tasks: - cred_list: + cred_list - list of credentials to validate For endpoint_tests.yml tasks: - endpoint_list: + endpoint_list - list of endpoints to validate For node_tests.yml tasks: - node_list: + node_list - list of nodes to validate For proj_test.yml tasks: - proj_list: + proj_list - list of projects to validate For pod_tests.yml tasks: - pod_list: + pod_list - list of pods to validate - pod_status_str: + pod_status_str - status of pods to check - pod_nspace: + pod_nspace - list of projects where pods exist For service_tests.yml tasks: - service_list: + service_list - list of services to validate - service_nspace: + service_nspace - project where services are running For manifest_tests.yml tasks: - manifest_list: + manifest_list - list of package manifests to validate For subscription_tests.yml tasks: - subscription_list: + subscription_list - list of subscriptions to validate - subscription_nspace: + subscription_nspace - project where the subscription lives - Dependencies ------------ From 0e20ddaca7a128dc97700c0ead83678666fbf739 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:52:47 -0400 Subject: [PATCH 36/64] Update README.md more formatting changes --- roles/qe_common/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md index d608b162..eafb2491 100644 --- a/roles/qe_common/README.md +++ b/roles/qe_common/README.md @@ -14,42 +14,54 @@ Variable required for all tasks to run: For cred_tests.yml tasks: cred_list + - list of credentials to validate For endpoint_tests.yml tasks: endpoint_list + - list of endpoints to validate For node_tests.yml tasks: node_list + - list of nodes to validate For proj_test.yml tasks: proj_list + - list of projects to validate For pod_tests.yml tasks: pod_list + - list of pods to validate pod_status_str + - status of pods to check pod_nspace + - list of projects where pods exist For service_tests.yml tasks: service_list + - list of services to validate service_nspace + - project where services are running For manifest_tests.yml tasks: manifest_list + - list of package manifests to validate For subscription_tests.yml tasks: subscription_list + - list of subscriptions to validate subscription_nspace + - project where the subscription lives From 664ddc522a5f317e4a63e88617c22beac3ffedf9 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:54:30 -0400 Subject: [PATCH 37/64] Update README.md formatting changes --- roles/qe_common/README.md | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md index eafb2491..ee1392c0 100644 --- a/roles/qe_common/README.md +++ b/roles/qe_common/README.md @@ -13,55 +13,51 @@ Role Variables Variable required for all tasks to run: For cred_tests.yml tasks: - cred_list - + + cred_list - list of credentials to validate For endpoint_tests.yml tasks: - endpoint_list - + + endpoint_list - list of endpoints to validate For node_tests.yml tasks: - node_list - + + node_list - list of nodes to validate For proj_test.yml tasks: - proj_list - + + proj_list - list of projects to validate For pod_tests.yml tasks: - pod_list - + + pod_list - list of pods to validate pod_status_str - - status of pods to check pod_nspace - - list of projects where pods exist For service_tests.yml tasks: - service_list - + + service_list - list of services to validate service_nspace - - project where services are running For manifest_tests.yml tasks: - manifest_list - + + manifest_list - list of package manifests to validate For subscription_tests.yml tasks: - subscription_list - + + subscription_list - list of subscriptions to validate subscription_nspace - - project where the subscription lives From abb808b688460dbd13dee35486dcfa80bdcc77af Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:56:10 -0400 Subject: [PATCH 38/64] Update pod_tests.yml changes nspace param name --- roles/qe_common/tasks/pod_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/qe_common/tasks/pod_tests.yml b/roles/qe_common/tasks/pod_tests.yml index 784d9281..45c13f11 100644 --- a/roles/qe_common/tasks/pod_tests.yml +++ b/roles/qe_common/tasks/pod_tests.yml @@ -3,14 +3,14 @@ - name: Get Pod Instance "{{ pod_status_str }}" ansible.builtin.shell: cmd: | - oc get pods -n "{{ nspace }}" | grep "{{ item }}" | grep "{{ pod_status_str }}" | awk '{print $1;}' + oc get pods -n "{{ pod_nspace }}" | grep "{{ item }}" | grep "{{ pod_status_str }}" | awk '{print $1;}' register: podinstance changed_when: false - name: Check terminated pod ansible.builtin.shell: cmd: | - oc get pod -n "{{ nspace }} {{ podinstance.stdout }}" + oc get pod -n "{{ pod_nspace }} {{ podinstance.stdout }}" register: output changed_when: false failed_when: From 79f004d617dfd60aa7df456113394f8827fc4862 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:56:48 -0400 Subject: [PATCH 39/64] Update service_tests.yml changed project name var --- roles/qe_common/tasks/service_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/tasks/service_tests.yml b/roles/qe_common/tasks/service_tests.yml index 8a60c243..ca132be2 100644 --- a/roles/qe_common/tasks/service_tests.yml +++ b/roles/qe_common/tasks/service_tests.yml @@ -1,7 +1,7 @@ - name: Verify Service Running - "{{ item }}" ansible.builtin.shell: cmd: | - oc get service -n "{{ nspace }}" "{{ item }}" + oc get service -n "{{ service_nspace }}" "{{ item }}" register: output changed_when: false failed_when: output.rc != 0 From 31a702f7b2920478b16432262e0a043ea4c707c2 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:57:17 -0400 Subject: [PATCH 40/64] Update subscription_tests.yml changed project name var --- roles/qe_common/tasks/subscription_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/tasks/subscription_tests.yml b/roles/qe_common/tasks/subscription_tests.yml index d19a5908..07e9f1d4 100644 --- a/roles/qe_common/tasks/subscription_tests.yml +++ b/roles/qe_common/tasks/subscription_tests.yml @@ -3,7 +3,7 @@ - name: Verify subscription ansible.builtin.shell: cmd: | - oc get subscriptions -n "{{ nspace }}" "{{ item }}" + oc get subscriptions -n "{{ subscription_nspace }}" "{{ item }}" register: output changed_when: false failed_when: output.rc != 0 From bfbe01ca10f71f8a3032b7e539ba56487330c887 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 10:02:54 -0400 Subject: [PATCH 41/64] Update README.md added more vars to list --- roles/qe_common/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md index ee1392c0..2ba352b5 100644 --- a/roles/qe_common/README.md +++ b/roles/qe_common/README.md @@ -12,6 +12,11 @@ Role Variables -------------- Variable required for all tasks to run: + For container_tests.yml tasks: + + container_list + - list of containers to validate + For cred_tests.yml tasks: cred_list @@ -22,6 +27,11 @@ Variable required for all tasks to run: endpoint_list - list of endpoints to validate + For file_tests.yml tasks: + + file_list + - list of files to verify + For node_tests.yml tasks: node_list From 2155f88caeddc6758f903cf750777c93b521851d Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:46:34 -0400 Subject: [PATCH 42/64] Update main.yml added loop into qe_common/tasks/main.yml --- roles/qe_common/tasks/main.yml | 62 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 66ea66e4..34dae2dd 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,62 +1,64 @@ --- -- name: "Verify container" +- when: container_list is defined + name: "Verify container" ansible.builtin.include_tasks: "container_tests.yml" - when: - - container_list is defined + loop: "{{ container_list }}" -- name: "Verify credential" +- when: cred_list is defined + name: "Verify credential" ansible.builtin.include_tasks: "cred_tests.yml" - when: - - cred_list is defined + loop: "{{ cred_list }}" -- name: "Verify endpoint in OSP" +- when: endpoint_list is defined + name: "Verify endpoint in OSP" ansible.builtin.include_tasks: "endpoint_tests.yml" - when: - - endpoint_list is defined + loop: "{{ endpoint_list }}" -- name: "Verify file" +- when: file_list is defined + name: "Verify file" ansible.builtin.include_tasks: "file_tests.yml" - when: - - file_list is defined + loop: "{{ file_list }}" -- name: "Verify manifest" +- when: manifest_list is defined + name: "Verify manifest" ansible.builtin.include_tasks: "manifest_tests.yml" - when: - - manifest_list is defined + loop: "{{ manifest_list }}" -- name: "Verify OSP node" +- when: node_list is defined + name: "Verify OSP node" ansible.builtin.include_tasks: node_tests.yml - when: - - node_list is defined + loop: "{{ node_list }}" -- name: "Verify pod" - ansible.builtin.include_tasks: "pod_tests.yml" - when: +- when: - pod_list is defined - nspace is defined - pod_status_str is defined + name: "Verify pod" + ansible.builtin.include_tasks: "pod_tests.yml" + loop: "{{ pod_list }}" -- name: "Verify project" +- when: proj_list is defined + name: "Verify project" ansible.builtin.include_tasks: "proj_tests.yml" - when: - - proj_list is defined + loop: "{{ proj_list }}" -- name: "Verify service" - ansible.builtin.include_tasks: "service_tests.yml" - when: +- when: - service_list is defined - nspace is defined + name: "Verify service" + ansible.builtin.include_tasks: "service_tests.yml" + loop: {{ service_list }}" -- name: "Verify subscription" +- when: subscription_list is defined + name: "Verify subscription" ansible.builtin.include_tasks: "subscription_tests.yml" - when: - - subscription_list is defined + loop: "{{ subscription_list }}" From b42f3e18e0bbfe0327edcffda5438da40ccaf458 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Wed, 10 Jul 2024 09:46:38 -0400 Subject: [PATCH 43/64] Update main.yml added polarion IDs to tasks in main.yml --- roles/qe_common/tasks/main.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 34dae2dd..0d54e025 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,36 +1,36 @@ --- - when: container_list is defined - name: "Verify container" + name: "Verify container - {{ container_polar_id}}" ansible.builtin.include_tasks: "container_tests.yml" loop: "{{ container_list }}" - when: cred_list is defined - name: "Verify credential" + name: "Verify credential - {{ cred_polar_id }}" ansible.builtin.include_tasks: "cred_tests.yml" loop: "{{ cred_list }}" - when: endpoint_list is defined - name: "Verify endpoint in OSP" + name: "Verify endpoint in OSP - {{ endpoint_polar_id }}" ansible.builtin.include_tasks: "endpoint_tests.yml" loop: "{{ endpoint_list }}" - when: file_list is defined - name: "Verify file" + name: "Verify file - {{ file_polar_id }}" ansible.builtin.include_tasks: "file_tests.yml" loop: "{{ file_list }}" - when: manifest_list is defined - name: "Verify manifest" + name: "Verify manifest - {{ manifest_polar_id }}" ansible.builtin.include_tasks: "manifest_tests.yml" loop: "{{ manifest_list }}" - when: node_list is defined - name: "Verify OSP node" + name: "Verify OSP node - {{ node_polar_id }}" ansible.builtin.include_tasks: node_tests.yml loop: "{{ node_list }}" @@ -39,13 +39,13 @@ - pod_list is defined - nspace is defined - pod_status_str is defined - name: "Verify pod" + name: "Verify pod - {{ pod_polar_id }}" ansible.builtin.include_tasks: "pod_tests.yml" loop: "{{ pod_list }}" - when: proj_list is defined - name: "Verify project" + name: "Verify project - {{ proj_polar_id}}" ansible.builtin.include_tasks: "proj_tests.yml" loop: "{{ proj_list }}" @@ -53,12 +53,12 @@ - when: - service_list is defined - nspace is defined - name: "Verify service" + name: "Verify service - {{ service_polar_id }}" ansible.builtin.include_tasks: "service_tests.yml" loop: {{ service_list }}" - when: subscription_list is defined - name: "Verify subscription" + name: "Verify subscription - {{ subscription_polar_id }}" ansible.builtin.include_tasks: "subscription_tests.yml" loop: "{{ subscription_list }}" From d6527b5a0b1351c72a22e98dcff803fff859eba1 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:47:33 -0400 Subject: [PATCH 44/64] Update README.md update docs showing all calls to role tasks are via main.yml now --- roles/qe_common/README.md | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md index 2ba352b5..c9aba428 100644 --- a/roles/qe_common/README.md +++ b/roles/qe_common/README.md @@ -14,37 +14,44 @@ Variable required for all tasks to run: For container_tests.yml tasks: + container_polar_id container_list - list of containers to validate For cred_tests.yml tasks: - + + cred_polar_id cred_list - list of credentials to validate For endpoint_tests.yml tasks: + endpoint_polar_id endpoint_list - list of endpoints to validate For file_tests.yml tasks: + file_polar_id file_list - list of files to verify For node_tests.yml tasks: - + + node_polar_id node_list - list of nodes to validate For proj_test.yml tasks: - + + proj_polar_id proj_list - list of projects to validate For pod_tests.yml tasks: - - pod_list + + pod_polar_id + pod_list - list of pods to validate pod_status_str - status of pods to check @@ -52,19 +59,22 @@ Variable required for all tasks to run: - list of projects where pods exist For service_tests.yml tasks: - + + service_polar_id service_list - list of services to validate service_nspace - project where services are running For manifest_tests.yml tasks: - + + manifest_polar_id manifest_list - list of package manifests to validate For subscription_tests.yml tasks: - + + subscription_polar_id subscription_list - list of subscriptions to validate subscription_nspace @@ -81,6 +91,7 @@ Example Playbook Typically, for this role the tests should *not* use a "main.yml" and import or include all the tests in the role. On the contrary, a tests should explicitly include specific tests needed for a given job. + hosts: controller gather_facts: no vars: @@ -92,17 +103,9 @@ Typically, for this role the tests should *not* use a "main.yml" and import or i - openshift-logging tasks: - - name: Remove "{{ proj_out_file }}" - ansible.builtin.file: - path: "{{ proj_out_file }}" - state: absent - changed_when: false - - - name: Verify projects created - ansible.builtin.include_role: + - name: Run projects tests + ansible.builtin.import_role: name: qe_common - tasks_from: proj_tests.yml - loop: "{{ proj_list }}" License From a836f64df423293cc653d07f00a8b3faf4bc228b Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Fri, 12 Jul 2024 16:04:52 +0100 Subject: [PATCH 45/64] Fix linter errors --- .ansible-lint | 2 -- roles/qe_common/tasks/container_tests.yml | 1 + roles/qe_common/tasks/cred_tests.yml | 1 + roles/qe_common/tasks/endpoint_tests.yml | 1 + roles/qe_common/tasks/main.yml | 43 ++++++++++++----------- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 79c620d4..005a27e1 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,12 +3,10 @@ exclude_paths: - ci/ - roles/telemetry_autoscaling - roles/telemetry_logging - - roles/qe_common skip_list: - command-instead-of-module # Using command rather than module - galaxy - meta-no-info # meta/main.yml should contain relevant info - 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 - yaml # Violations reported by yamllint diff --git a/roles/qe_common/tasks/container_tests.yml b/roles/qe_common/tasks/container_tests.yml index ff8e0fe8..aba1e4e8 100644 --- a/roles/qe_common/tasks/container_tests.yml +++ b/roles/qe_common/tasks/container_tests.yml @@ -4,5 +4,6 @@ ansible.builtin.shell: cmd: | podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' + change_when: false register: container_status failed_when: container_status.stdout != "Up" diff --git a/roles/qe_common/tasks/cred_tests.yml b/roles/qe_common/tasks/cred_tests.yml index 1305bf7e..b8d6ef0d 100644 --- a/roles/qe_common/tasks/cred_tests.yml +++ b/roles/qe_common/tasks/cred_tests.yml @@ -4,5 +4,6 @@ ansible.builtin.shell: cmd: | oc get crd "{{ item }}" + changed_when: false register: output failed_when: output.rc != 0 diff --git a/roles/qe_common/tasks/endpoint_tests.yml b/roles/qe_common/tasks/endpoint_tests.yml index 10c7a578..819a0795 100644 --- a/roles/qe_common/tasks/endpoint_tests.yml +++ b/roles/qe_common/tasks/endpoint_tests.yml @@ -5,5 +5,6 @@ cmd: | oc project openstack kubectl exec openstackclient -- openstack endpoint list --service="{{ item[0] }}" --service="{{ item[1] }}" --interface="{{ item[2] }}" + changed_when: false register: result failed_when: result.rc != 0 diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 0d54e025..2bc44064 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,64 +1,65 @@ --- -- when: container_list is defined - name: "Verify container - {{ container_polar_id}}" +- name: "Verify container - {{ container_polar_id }}" + when: container_list is defined ansible.builtin.include_tasks: "container_tests.yml" loop: "{{ container_list }}" -- when: cred_list is defined - name: "Verify credential - {{ cred_polar_id }}" +- name: "Verify credential - {{ cred_polar_id }}" + when: cred_list is defined ansible.builtin.include_tasks: "cred_tests.yml" loop: "{{ cred_list }}" -- when: endpoint_list is defined - name: "Verify endpoint in OSP - {{ endpoint_polar_id }}" +- name: "Verify endpoint in OSP - {{ endpoint_polar_id }}" + when: endpoint_list is defined ansible.builtin.include_tasks: "endpoint_tests.yml" loop: "{{ endpoint_list }}" -- when: file_list is defined - name: "Verify file - {{ file_polar_id }}" +- name: "Verify file - {{ file_polar_id }}" + when: file_list is defined ansible.builtin.include_tasks: "file_tests.yml" loop: "{{ file_list }}" -- when: manifest_list is defined - name: "Verify manifest - {{ manifest_polar_id }}" +- name: "Verify manifest - {{ manifest_polar_id }}" + when: manifest_list is defined ansible.builtin.include_tasks: "manifest_tests.yml" loop: "{{ manifest_list }}" -- when: node_list is defined - name: "Verify OSP node - {{ node_polar_id }}" +- name: "Verify OSP node - {{ node_polar_id }}" + when: node_list is defined ansible.builtin.include_tasks: node_tests.yml loop: "{{ node_list }}" -- when: +- name: "Verify pod - {{ pod_polar_id }}" + when: - pod_list is defined - nspace is defined - pod_status_str is defined - name: "Verify pod - {{ pod_polar_id }}" ansible.builtin.include_tasks: "pod_tests.yml" loop: "{{ pod_list }}" -- when: proj_list is defined - name: "Verify project - {{ proj_polar_id}}" + +- name: "Verify project - {{ proj_polar_id }}" + when: proj_list is defined ansible.builtin.include_tasks: "proj_tests.yml" loop: "{{ proj_list }}" -- when: +- name: "Verify service - {{ service_polar_id }}" + when: - service_list is defined - nspace is defined - name: "Verify service - {{ service_polar_id }}" ansible.builtin.include_tasks: "service_tests.yml" - loop: {{ service_list }}" + loop: "{{ service_list }}" -- when: subscription_list is defined - name: "Verify subscription - {{ subscription_polar_id }}" +- name: "Verify subscription - {{ subscription_polar_id }}" + when: subscription_list is defined ansible.builtin.include_tasks: "subscription_tests.yml" loop: "{{ subscription_list }}" From e32527853693eee25c754e5dc5a85a811abfef5b Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:38:09 -0400 Subject: [PATCH 46/64] Update main.yml updated test_id var name --- roles/qe_common/tasks/main.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml index 2bc44064..b43e321e 100644 --- a/roles/qe_common/tasks/main.yml +++ b/roles/qe_common/tasks/main.yml @@ -1,41 +1,41 @@ --- -- name: "Verify container - {{ container_polar_id }}" +- name: "Verify container - {{ container_test_id }}" when: container_list is defined ansible.builtin.include_tasks: "container_tests.yml" loop: "{{ container_list }}" -- name: "Verify credential - {{ cred_polar_id }}" +- name: "Verify credential - {{ cred_test_id }}" when: cred_list is defined ansible.builtin.include_tasks: "cred_tests.yml" loop: "{{ cred_list }}" -- name: "Verify endpoint in OSP - {{ endpoint_polar_id }}" +- name: "Verify endpoint in OSP - {{ endpoint_test_id }}" when: endpoint_list is defined ansible.builtin.include_tasks: "endpoint_tests.yml" loop: "{{ endpoint_list }}" -- name: "Verify file - {{ file_polar_id }}" +- name: "Verify file - {{ file_test_id }}" when: file_list is defined ansible.builtin.include_tasks: "file_tests.yml" loop: "{{ file_list }}" -- name: "Verify manifest - {{ manifest_polar_id }}" +- name: "Verify manifest - {{ manifest_test_id }}" when: manifest_list is defined ansible.builtin.include_tasks: "manifest_tests.yml" loop: "{{ manifest_list }}" -- name: "Verify OSP node - {{ node_polar_id }}" +- name: "Verify OSP node - {{ node_test_id }}" when: node_list is defined ansible.builtin.include_tasks: node_tests.yml loop: "{{ node_list }}" -- name: "Verify pod - {{ pod_polar_id }}" +- name: "Verify pod - {{ pod_test_id }}" when: - pod_list is defined - nspace is defined @@ -45,13 +45,13 @@ -- name: "Verify project - {{ proj_polar_id }}" +- name: "Verify project - {{ proj_test_id }}" when: proj_list is defined ansible.builtin.include_tasks: "proj_tests.yml" loop: "{{ proj_list }}" -- name: "Verify service - {{ service_polar_id }}" +- name: "Verify service - {{ service_test_id }}" when: - service_list is defined - nspace is defined @@ -59,7 +59,7 @@ loop: "{{ service_list }}" -- name: "Verify subscription - {{ subscription_polar_id }}" +- name: "Verify subscription - {{ subscription_test_id }}" when: subscription_list is defined ansible.builtin.include_tasks: "subscription_tests.yml" loop: "{{ subscription_list }}" From dbce856b550570aa20e60166d603c73b60595788 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:58:29 -0400 Subject: [PATCH 47/64] Update README.md updated role name --- roles/qe_common/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md index c9aba428..48454df8 100644 --- a/roles/qe_common/README.md +++ b/roles/qe_common/README.md @@ -1,4 +1,4 @@ -qe_common +common ========= The tests in this role are not specific to any one functional area but are an aggregate of common tests that can be used in all OSP 18.0/OCP jobs. From 9b55e7835349a90d66a74d4a2358dbb0c2745f3e Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:04:09 -0400 Subject: [PATCH 48/64] Create README.md --- roles/common/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/common/README.md diff --git a/roles/common/README.md b/roles/common/README.md new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/roles/common/README.md @@ -0,0 +1 @@ + From 5ec4c852ffd0c8acb8e41fa6457b06299a28440a Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:05:34 -0400 Subject: [PATCH 49/64] Update README.md moved role to new dir --- roles/common/README.md | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/roles/common/README.md b/roles/common/README.md index 8b137891..48454df8 100644 --- a/roles/common/README.md +++ b/roles/common/README.md @@ -1 +1,119 @@ +common +========= +The tests in this role are not specific to any one functional area but are an aggregate of common tests that can be used in all OSP 18.0/OCP jobs. + +Requirements +------------ + +None + +Role Variables +-------------- +Variable required for all tasks to run: + + For container_tests.yml tasks: + + container_polar_id + container_list + - list of containers to validate + + For cred_tests.yml tasks: + + cred_polar_id + cred_list + - list of credentials to validate + + For endpoint_tests.yml tasks: + + endpoint_polar_id + endpoint_list + - list of endpoints to validate + + For file_tests.yml tasks: + + file_polar_id + file_list + - list of files to verify + + For node_tests.yml tasks: + + node_polar_id + node_list + - list of nodes to validate + + For proj_test.yml tasks: + + proj_polar_id + proj_list + - list of projects to validate + + For pod_tests.yml tasks: + + pod_polar_id + pod_list + - list of pods to validate + pod_status_str + - status of pods to check + pod_nspace + - list of projects where pods exist + + For service_tests.yml tasks: + + service_polar_id + service_list + - list of services to validate + service_nspace + - project where services are running + + For manifest_tests.yml tasks: + + manifest_polar_id + manifest_list + - list of package manifests to validate + + For subscription_tests.yml tasks: + + subscription_polar_id + subscription_list + - list of subscriptions to validate + subscription_nspace + - project where the subscription lives + + +Dependencies +------------ + +None + +Example Playbook +---------------- + +Typically, for this role the tests should *not* use a "main.yml" and import or include all the tests in the role. On the contrary, a tests should explicitly include specific tests needed for a given job. + + + hosts: controller + gather_facts: no + vars: + proj_out_file: verify_logging_projects_exist_lresults.log + proj_list: + - openshift-openstack-infra + - openshift + - openstack-operators + - openshift-logging + + tasks: + - name: Run projects tests + ansible.builtin.import_role: + name: qe_common + + +License +------- + +Apache 2 + +Author Information +------------------ + +alexy@redhat.com From 3bda671a6f85612112f5885e5c58c8baff836794 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:09:35 -0400 Subject: [PATCH 50/64] Create main.yml initial file --- roles/common/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/common/tasks/main.yml diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/roles/common/tasks/main.yml @@ -0,0 +1 @@ + From 86bc4c47ac7d0cc84a99420111278a12543e1666 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:13:37 -0400 Subject: [PATCH 51/64] role name change qe_common role name change to common --- roles/common/tasks/container_tests.yml | 9 ++++ roles/common/tasks/cred_tests.yml | 9 ++++ roles/common/tasks/endpoint_tests.yml | 10 ++++ roles/common/tasks/file_tests.yml | 12 +++++ roles/common/tasks/main.yml | 64 +++++++++++++++++++++++ roles/common/tasks/manifest_tests.yml | 23 ++++++++ roles/common/tasks/node_tests.yml | 18 +++++++ roles/common/tasks/pod_tests.yml | 20 +++++++ roles/common/tasks/proj_tests.yml | 9 ++++ roles/common/tasks/service_tests.yml | 7 +++ roles/common/tasks/subscription_tests.yml | 9 ++++ 11 files changed, 190 insertions(+) create mode 100644 roles/common/tasks/container_tests.yml create mode 100644 roles/common/tasks/cred_tests.yml create mode 100644 roles/common/tasks/endpoint_tests.yml create mode 100644 roles/common/tasks/file_tests.yml create mode 100644 roles/common/tasks/manifest_tests.yml create mode 100644 roles/common/tasks/node_tests.yml create mode 100644 roles/common/tasks/pod_tests.yml create mode 100644 roles/common/tasks/proj_tests.yml create mode 100644 roles/common/tasks/service_tests.yml create mode 100644 roles/common/tasks/subscription_tests.yml diff --git a/roles/common/tasks/container_tests.yml b/roles/common/tasks/container_tests.yml new file mode 100644 index 00000000..aba1e4e8 --- /dev/null +++ b/roles/common/tasks/container_tests.yml @@ -0,0 +1,9 @@ +--- + +- name: Get container status + ansible.builtin.shell: + cmd: | + podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' + change_when: false + register: container_status + failed_when: container_status.stdout != "Up" diff --git a/roles/common/tasks/cred_tests.yml b/roles/common/tasks/cred_tests.yml new file mode 100644 index 00000000..b8d6ef0d --- /dev/null +++ b/roles/common/tasks/cred_tests.yml @@ -0,0 +1,9 @@ +--- + +- name: Verify logging credentials "{{ item }}" + ansible.builtin.shell: + cmd: | + oc get crd "{{ item }}" + changed_when: false + register: output + failed_when: output.rc != 0 diff --git a/roles/common/tasks/endpoint_tests.yml b/roles/common/tasks/endpoint_tests.yml new file mode 100644 index 00000000..819a0795 --- /dev/null +++ b/roles/common/tasks/endpoint_tests.yml @@ -0,0 +1,10 @@ +--- + +- name: Get Endpoint + ansible.builtin.shell: + cmd: | + oc project openstack + kubectl exec openstackclient -- openstack endpoint list --service="{{ item[0] }}" --service="{{ item[1] }}" --interface="{{ item[2] }}" + changed_when: false + register: result + failed_when: result.rc != 0 diff --git a/roles/common/tasks/file_tests.yml b/roles/common/tasks/file_tests.yml new file mode 100644 index 00000000..275519bf --- /dev/null +++ b/roles/common/tasks/file_tests.yml @@ -0,0 +1,12 @@ +--- + +- name: Get stats for file + ansible.builtin.stat: + path: "{{ item }}" + register: fstats + failed_when: + - fstats.stat.pw_name != "root" + - fstats.stat.size | int < 300 + - not fstats.stat.exists + - not fstats.stat.isreg + diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 8b137891..b43e321e 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1 +1,65 @@ +--- +- name: "Verify container - {{ container_test_id }}" + when: container_list is defined + ansible.builtin.include_tasks: "container_tests.yml" + loop: "{{ container_list }}" + +- name: "Verify credential - {{ cred_test_id }}" + when: cred_list is defined + ansible.builtin.include_tasks: "cred_tests.yml" + loop: "{{ cred_list }}" + + +- name: "Verify endpoint in OSP - {{ endpoint_test_id }}" + when: endpoint_list is defined + ansible.builtin.include_tasks: "endpoint_tests.yml" + loop: "{{ endpoint_list }}" + + +- name: "Verify file - {{ file_test_id }}" + when: file_list is defined + ansible.builtin.include_tasks: "file_tests.yml" + loop: "{{ file_list }}" + + +- name: "Verify manifest - {{ manifest_test_id }}" + when: manifest_list is defined + ansible.builtin.include_tasks: "manifest_tests.yml" + loop: "{{ manifest_list }}" + + +- name: "Verify OSP node - {{ node_test_id }}" + when: node_list is defined + ansible.builtin.include_tasks: node_tests.yml + loop: "{{ node_list }}" + + +- name: "Verify pod - {{ pod_test_id }}" + when: + - pod_list is defined + - nspace is defined + - pod_status_str is defined + ansible.builtin.include_tasks: "pod_tests.yml" + loop: "{{ pod_list }}" + + + +- name: "Verify project - {{ proj_test_id }}" + when: proj_list is defined + ansible.builtin.include_tasks: "proj_tests.yml" + loop: "{{ proj_list }}" + + +- name: "Verify service - {{ service_test_id }}" + when: + - service_list is defined + - nspace is defined + ansible.builtin.include_tasks: "service_tests.yml" + loop: "{{ service_list }}" + + +- name: "Verify subscription - {{ subscription_test_id }}" + when: subscription_list is defined + ansible.builtin.include_tasks: "subscription_tests.yml" + loop: "{{ subscription_list }}" diff --git a/roles/common/tasks/manifest_tests.yml b/roles/common/tasks/manifest_tests.yml new file mode 100644 index 00000000..1dbb3ed0 --- /dev/null +++ b/roles/common/tasks/manifest_tests.yml @@ -0,0 +1,23 @@ +--- + +- name: Get number of packages + ansible.builtin.shell: + cmd: | + echo "{{ item }}" | awk '{print $2;}' + register: num_expected + changed_when: false + +- name: Get package name + ansible.builtin.shell: + cmd: | + echo "{{ item }}" | awk '{print $1;}' + register: pack_name + changed_when: false + +- name: Get packagemanifest + 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 diff --git a/roles/common/tasks/node_tests.yml b/roles/common/tasks/node_tests.yml new file mode 100644 index 00000000..ac0f751c --- /dev/null +++ b/roles/common/tasks/node_tests.yml @@ -0,0 +1,18 @@ +--- + +- name: Get running node + become: true + ansible.builtin.shell: + cmd: | + virsh list --state-running | grep "{{ item }}" | awk '{print $2;}' + register: nodefound + changed_when: false + +- name: Get node status + become: true + ansible.builtin.shell: + cmd: | + virsh list --state-running | grep "{{ item }}" | awk '{print $3;}' + register: output + changed_when: false + failed_when: output.stdout != "running" diff --git a/roles/common/tasks/pod_tests.yml b/roles/common/tasks/pod_tests.yml new file mode 100644 index 00000000..45c13f11 --- /dev/null +++ b/roles/common/tasks/pod_tests.yml @@ -0,0 +1,20 @@ +--- + +- name: Get Pod Instance "{{ pod_status_str }}" + ansible.builtin.shell: + cmd: | + oc get pods -n "{{ pod_nspace }}" | grep "{{ item }}" | grep "{{ pod_status_str }}" | awk '{print $1;}' + register: podinstance + changed_when: false + +- name: Check terminated pod + ansible.builtin.shell: + cmd: | + oc get pod -n "{{ pod_nspace }} {{ podinstance.stdout }}" + register: output + changed_when: false + failed_when: + - output.rc != 0 + - podinstance.stdout == "" + + diff --git a/roles/common/tasks/proj_tests.yml b/roles/common/tasks/proj_tests.yml new file mode 100644 index 00000000..b852ac02 --- /dev/null +++ b/roles/common/tasks/proj_tests.yml @@ -0,0 +1,9 @@ +--- + +- name: Verify Project exists - "{{ item }}" + ansible.builtin.shell: + cmd: | + oc project "{{ item }}" + register: output + changed_when: false + failed_when: output.rc != 0 diff --git a/roles/common/tasks/service_tests.yml b/roles/common/tasks/service_tests.yml new file mode 100644 index 00000000..ca132be2 --- /dev/null +++ b/roles/common/tasks/service_tests.yml @@ -0,0 +1,7 @@ +- name: Verify Service Running - "{{ item }}" + ansible.builtin.shell: + cmd: | + oc get service -n "{{ service_nspace }}" "{{ item }}" + register: output + changed_when: false + failed_when: output.rc != 0 diff --git a/roles/common/tasks/subscription_tests.yml b/roles/common/tasks/subscription_tests.yml new file mode 100644 index 00000000..07e9f1d4 --- /dev/null +++ b/roles/common/tasks/subscription_tests.yml @@ -0,0 +1,9 @@ +--- + +- name: Verify subscription + ansible.builtin.shell: + cmd: | + oc get subscriptions -n "{{ subscription_nspace }}" "{{ item }}" + register: output + changed_when: false + failed_when: output.rc != 0 From cc8994bae8e06e053799f38bae55df889c4b636b Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:15:13 -0400 Subject: [PATCH 52/64] Update README.md test id var change --- roles/common/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/common/README.md b/roles/common/README.md index 48454df8..e8598be4 100644 --- a/roles/common/README.md +++ b/roles/common/README.md @@ -14,43 +14,43 @@ Variable required for all tasks to run: For container_tests.yml tasks: - container_polar_id + container_test_id container_list - list of containers to validate For cred_tests.yml tasks: - cred_polar_id + cred_test_id cred_list - list of credentials to validate For endpoint_tests.yml tasks: - endpoint_polar_id + endpoint_test_id endpoint_list - list of endpoints to validate For file_tests.yml tasks: - file_polar_id + file_test_id file_list - list of files to verify For node_tests.yml tasks: - node_polar_id + node_test_id node_list - list of nodes to validate For proj_test.yml tasks: - proj_polar_id + proj_test_id proj_list - list of projects to validate For pod_tests.yml tasks: - pod_polar_id + pod_test_id pod_list - list of pods to validate pod_status_str @@ -60,7 +60,7 @@ Variable required for all tasks to run: For service_tests.yml tasks: - service_polar_id + service_test_id service_list - list of services to validate service_nspace @@ -68,7 +68,7 @@ Variable required for all tasks to run: For manifest_tests.yml tasks: - manifest_polar_id + manifest_test_id manifest_list - list of package manifests to validate From 606fc827ca311e3467e5f597a2c1eef92e37b482 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:15:55 -0400 Subject: [PATCH 53/64] Delete roles/qe_common directory remove qe_common role dir --- roles/qe_common/README.md | 119 ------------------- roles/qe_common/tasks/container_tests.yml | 9 -- roles/qe_common/tasks/cred_tests.yml | 9 -- roles/qe_common/tasks/endpoint_tests.yml | 10 -- roles/qe_common/tasks/file_tests.yml | 12 -- roles/qe_common/tasks/main.yml | 65 ---------- roles/qe_common/tasks/manifest_tests.yml | 23 ---- roles/qe_common/tasks/node_tests.yml | 18 --- roles/qe_common/tasks/pod_tests.yml | 20 ---- roles/qe_common/tasks/proj_tests.yml | 9 -- roles/qe_common/tasks/service_tests.yml | 7 -- roles/qe_common/tasks/subscription_tests.yml | 9 -- 12 files changed, 310 deletions(-) delete mode 100644 roles/qe_common/README.md delete mode 100644 roles/qe_common/tasks/container_tests.yml delete mode 100644 roles/qe_common/tasks/cred_tests.yml delete mode 100644 roles/qe_common/tasks/endpoint_tests.yml delete mode 100644 roles/qe_common/tasks/file_tests.yml delete mode 100644 roles/qe_common/tasks/main.yml delete mode 100644 roles/qe_common/tasks/manifest_tests.yml delete mode 100644 roles/qe_common/tasks/node_tests.yml delete mode 100644 roles/qe_common/tasks/pod_tests.yml delete mode 100644 roles/qe_common/tasks/proj_tests.yml delete mode 100644 roles/qe_common/tasks/service_tests.yml delete mode 100644 roles/qe_common/tasks/subscription_tests.yml diff --git a/roles/qe_common/README.md b/roles/qe_common/README.md deleted file mode 100644 index 48454df8..00000000 --- a/roles/qe_common/README.md +++ /dev/null @@ -1,119 +0,0 @@ -common -========= - -The tests in this role are not specific to any one functional area but are an aggregate of common tests that can be used in all OSP 18.0/OCP jobs. - -Requirements ------------- - -None - -Role Variables --------------- -Variable required for all tasks to run: - - For container_tests.yml tasks: - - container_polar_id - container_list - - list of containers to validate - - For cred_tests.yml tasks: - - cred_polar_id - cred_list - - list of credentials to validate - - For endpoint_tests.yml tasks: - - endpoint_polar_id - endpoint_list - - list of endpoints to validate - - For file_tests.yml tasks: - - file_polar_id - file_list - - list of files to verify - - For node_tests.yml tasks: - - node_polar_id - node_list - - list of nodes to validate - - For proj_test.yml tasks: - - proj_polar_id - proj_list - - list of projects to validate - - For pod_tests.yml tasks: - - pod_polar_id - pod_list - - list of pods to validate - pod_status_str - - status of pods to check - pod_nspace - - list of projects where pods exist - - For service_tests.yml tasks: - - service_polar_id - service_list - - list of services to validate - service_nspace - - project where services are running - - For manifest_tests.yml tasks: - - manifest_polar_id - manifest_list - - list of package manifests to validate - - For subscription_tests.yml tasks: - - subscription_polar_id - subscription_list - - list of subscriptions to validate - subscription_nspace - - project where the subscription lives - - -Dependencies ------------- - -None - -Example Playbook ----------------- - -Typically, for this role the tests should *not* use a "main.yml" and import or include all the tests in the role. On the contrary, a tests should explicitly include specific tests needed for a given job. - - - hosts: controller - gather_facts: no - vars: - proj_out_file: verify_logging_projects_exist_lresults.log - proj_list: - - openshift-openstack-infra - - openshift - - openstack-operators - - openshift-logging - - tasks: - - name: Run projects tests - ansible.builtin.import_role: - name: qe_common - - -License -------- - -Apache 2 - -Author Information ------------------- - -alexy@redhat.com diff --git a/roles/qe_common/tasks/container_tests.yml b/roles/qe_common/tasks/container_tests.yml deleted file mode 100644 index aba1e4e8..00000000 --- a/roles/qe_common/tasks/container_tests.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- - -- name: Get container status - ansible.builtin.shell: - cmd: | - podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' - change_when: false - register: container_status - failed_when: container_status.stdout != "Up" diff --git a/roles/qe_common/tasks/cred_tests.yml b/roles/qe_common/tasks/cred_tests.yml deleted file mode 100644 index b8d6ef0d..00000000 --- a/roles/qe_common/tasks/cred_tests.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- - -- name: Verify logging credentials "{{ item }}" - ansible.builtin.shell: - cmd: | - oc get crd "{{ item }}" - changed_when: false - register: output - failed_when: output.rc != 0 diff --git a/roles/qe_common/tasks/endpoint_tests.yml b/roles/qe_common/tasks/endpoint_tests.yml deleted file mode 100644 index 819a0795..00000000 --- a/roles/qe_common/tasks/endpoint_tests.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- - -- name: Get Endpoint - ansible.builtin.shell: - cmd: | - oc project openstack - kubectl exec openstackclient -- openstack endpoint list --service="{{ item[0] }}" --service="{{ item[1] }}" --interface="{{ item[2] }}" - changed_when: false - register: result - failed_when: result.rc != 0 diff --git a/roles/qe_common/tasks/file_tests.yml b/roles/qe_common/tasks/file_tests.yml deleted file mode 100644 index 275519bf..00000000 --- a/roles/qe_common/tasks/file_tests.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- - -- name: Get stats for file - ansible.builtin.stat: - path: "{{ item }}" - register: fstats - failed_when: - - fstats.stat.pw_name != "root" - - fstats.stat.size | int < 300 - - not fstats.stat.exists - - not fstats.stat.isreg - diff --git a/roles/qe_common/tasks/main.yml b/roles/qe_common/tasks/main.yml deleted file mode 100644 index b43e321e..00000000 --- a/roles/qe_common/tasks/main.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -- name: "Verify container - {{ container_test_id }}" - when: container_list is defined - ansible.builtin.include_tasks: "container_tests.yml" - loop: "{{ container_list }}" - - -- name: "Verify credential - {{ cred_test_id }}" - when: cred_list is defined - ansible.builtin.include_tasks: "cred_tests.yml" - loop: "{{ cred_list }}" - - -- name: "Verify endpoint in OSP - {{ endpoint_test_id }}" - when: endpoint_list is defined - ansible.builtin.include_tasks: "endpoint_tests.yml" - loop: "{{ endpoint_list }}" - - -- name: "Verify file - {{ file_test_id }}" - when: file_list is defined - ansible.builtin.include_tasks: "file_tests.yml" - loop: "{{ file_list }}" - - -- name: "Verify manifest - {{ manifest_test_id }}" - when: manifest_list is defined - ansible.builtin.include_tasks: "manifest_tests.yml" - loop: "{{ manifest_list }}" - - -- name: "Verify OSP node - {{ node_test_id }}" - when: node_list is defined - ansible.builtin.include_tasks: node_tests.yml - loop: "{{ node_list }}" - - -- name: "Verify pod - {{ pod_test_id }}" - when: - - pod_list is defined - - nspace is defined - - pod_status_str is defined - ansible.builtin.include_tasks: "pod_tests.yml" - loop: "{{ pod_list }}" - - - -- name: "Verify project - {{ proj_test_id }}" - when: proj_list is defined - ansible.builtin.include_tasks: "proj_tests.yml" - loop: "{{ proj_list }}" - - -- name: "Verify service - {{ service_test_id }}" - when: - - service_list is defined - - nspace is defined - ansible.builtin.include_tasks: "service_tests.yml" - loop: "{{ service_list }}" - - -- name: "Verify subscription - {{ subscription_test_id }}" - when: subscription_list is defined - ansible.builtin.include_tasks: "subscription_tests.yml" - loop: "{{ subscription_list }}" diff --git a/roles/qe_common/tasks/manifest_tests.yml b/roles/qe_common/tasks/manifest_tests.yml deleted file mode 100644 index 1dbb3ed0..00000000 --- a/roles/qe_common/tasks/manifest_tests.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- - -- name: Get number of packages - ansible.builtin.shell: - cmd: | - echo "{{ item }}" | awk '{print $2;}' - register: num_expected - changed_when: false - -- name: Get package name - ansible.builtin.shell: - cmd: | - echo "{{ item }}" | awk '{print $1;}' - register: pack_name - changed_when: false - -- name: Get packagemanifest - 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 diff --git a/roles/qe_common/tasks/node_tests.yml b/roles/qe_common/tasks/node_tests.yml deleted file mode 100644 index ac0f751c..00000000 --- a/roles/qe_common/tasks/node_tests.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- - -- name: Get running node - become: true - ansible.builtin.shell: - cmd: | - virsh list --state-running | grep "{{ item }}" | awk '{print $2;}' - register: nodefound - changed_when: false - -- name: Get node status - become: true - ansible.builtin.shell: - cmd: | - virsh list --state-running | grep "{{ item }}" | awk '{print $3;}' - register: output - changed_when: false - failed_when: output.stdout != "running" diff --git a/roles/qe_common/tasks/pod_tests.yml b/roles/qe_common/tasks/pod_tests.yml deleted file mode 100644 index 45c13f11..00000000 --- a/roles/qe_common/tasks/pod_tests.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- - -- name: Get Pod Instance "{{ pod_status_str }}" - ansible.builtin.shell: - cmd: | - oc get pods -n "{{ pod_nspace }}" | grep "{{ item }}" | grep "{{ pod_status_str }}" | awk '{print $1;}' - register: podinstance - changed_when: false - -- name: Check terminated pod - ansible.builtin.shell: - cmd: | - oc get pod -n "{{ pod_nspace }} {{ podinstance.stdout }}" - register: output - changed_when: false - failed_when: - - output.rc != 0 - - podinstance.stdout == "" - - diff --git a/roles/qe_common/tasks/proj_tests.yml b/roles/qe_common/tasks/proj_tests.yml deleted file mode 100644 index b852ac02..00000000 --- a/roles/qe_common/tasks/proj_tests.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- - -- name: Verify Project exists - "{{ item }}" - ansible.builtin.shell: - cmd: | - oc project "{{ item }}" - register: output - changed_when: false - failed_when: output.rc != 0 diff --git a/roles/qe_common/tasks/service_tests.yml b/roles/qe_common/tasks/service_tests.yml deleted file mode 100644 index ca132be2..00000000 --- a/roles/qe_common/tasks/service_tests.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: Verify Service Running - "{{ item }}" - ansible.builtin.shell: - cmd: | - oc get service -n "{{ service_nspace }}" "{{ item }}" - register: output - changed_when: false - failed_when: output.rc != 0 diff --git a/roles/qe_common/tasks/subscription_tests.yml b/roles/qe_common/tasks/subscription_tests.yml deleted file mode 100644 index 07e9f1d4..00000000 --- a/roles/qe_common/tasks/subscription_tests.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- - -- name: Verify subscription - ansible.builtin.shell: - cmd: | - oc get subscriptions -n "{{ subscription_nspace }}" "{{ item }}" - register: output - changed_when: false - failed_when: output.rc != 0 From 7e50ef47be68b2468ec203cf289f7313fcd98ea2 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:25:34 -0400 Subject: [PATCH 54/64] Update .ansible-lint roles/qe_common name change to roles/common --- .ansible-lint | 1 + 1 file changed, 1 insertion(+) diff --git a/.ansible-lint b/.ansible-lint index 005a27e1..55ac0c5d 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,6 +3,7 @@ exclude_paths: - ci/ - roles/telemetry_autoscaling - roles/telemetry_logging + - roles/commmon skip_list: - command-instead-of-module # Using command rather than module - galaxy From ffb00b341d17ca47d43da1aa7b277dac6fa9a8f0 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:26:39 -0400 Subject: [PATCH 55/64] Update README.md qe_common role rename to common --- roles/common/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/common/README.md b/roles/common/README.md index e8598be4..dde23299 100644 --- a/roles/common/README.md +++ b/roles/common/README.md @@ -105,7 +105,7 @@ Typically, for this role the tests should *not* use a "main.yml" and import or i tasks: - name: Run projects tests ansible.builtin.import_role: - name: qe_common + name: common License From d47e091018fc2fa1255c26ac5cf500fd77f346c2 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:28:49 -0400 Subject: [PATCH 56/64] Update cred_tests.yml remove unneeded line --- roles/common/tasks/cred_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/common/tasks/cred_tests.yml b/roles/common/tasks/cred_tests.yml index b8d6ef0d..341514ef 100644 --- a/roles/common/tasks/cred_tests.yml +++ b/roles/common/tasks/cred_tests.yml @@ -6,4 +6,3 @@ oc get crd "{{ item }}" changed_when: false register: output - failed_when: output.rc != 0 From 39c2ff18370db853051d955c0b0ed7806a06c9e5 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:29:13 -0400 Subject: [PATCH 57/64] Update endpoint_tests.yml remove unneeded line --- roles/common/tasks/endpoint_tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/common/tasks/endpoint_tests.yml b/roles/common/tasks/endpoint_tests.yml index 819a0795..5c9d06bf 100644 --- a/roles/common/tasks/endpoint_tests.yml +++ b/roles/common/tasks/endpoint_tests.yml @@ -6,5 +6,4 @@ oc project openstack kubectl exec openstackclient -- openstack endpoint list --service="{{ item[0] }}" --service="{{ item[1] }}" --interface="{{ item[2] }}" changed_when: false - register: result - failed_when: result.rc != 0 + register: output From 705a2cd0d2e5ca07f48398a342b1bf103d301078 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:30:16 -0400 Subject: [PATCH 58/64] Update proj_tests.yml remove unneeded line --- roles/common/tasks/proj_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/common/tasks/proj_tests.yml b/roles/common/tasks/proj_tests.yml index b852ac02..50e2bda8 100644 --- a/roles/common/tasks/proj_tests.yml +++ b/roles/common/tasks/proj_tests.yml @@ -6,4 +6,3 @@ oc project "{{ item }}" register: output changed_when: false - failed_when: output.rc != 0 From 9b3451a7a0014ab87b8042815169b830e2671629 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:30:43 -0400 Subject: [PATCH 59/64] Update service_tests.yml remove unneeded line --- roles/common/tasks/service_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/common/tasks/service_tests.yml b/roles/common/tasks/service_tests.yml index ca132be2..b007ad0e 100644 --- a/roles/common/tasks/service_tests.yml +++ b/roles/common/tasks/service_tests.yml @@ -4,4 +4,3 @@ oc get service -n "{{ service_nspace }}" "{{ item }}" register: output changed_when: false - failed_when: output.rc != 0 From f8c40ad350608abb27f783dd711797d7f30734c3 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:31:02 -0400 Subject: [PATCH 60/64] Update subscription_tests.yml remove unneeded line --- roles/common/tasks/subscription_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/common/tasks/subscription_tests.yml b/roles/common/tasks/subscription_tests.yml index 07e9f1d4..9e45c198 100644 --- a/roles/common/tasks/subscription_tests.yml +++ b/roles/common/tasks/subscription_tests.yml @@ -6,4 +6,3 @@ oc get subscriptions -n "{{ subscription_nspace }}" "{{ item }}" register: output changed_when: false - failed_when: output.rc != 0 From 6e3283c4e20a33848655455717cb290883e6f852 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:32:46 -0400 Subject: [PATCH 61/64] Update README.md lint changes --- roles/common/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/common/README.md b/roles/common/README.md index dde23299..62f30101 100644 --- a/roles/common/README.md +++ b/roles/common/README.md @@ -25,13 +25,13 @@ Variable required for all tasks to run: - list of credentials to validate For endpoint_tests.yml tasks: - + endpoint_test_id endpoint_list - list of endpoints to validate For file_tests.yml tasks: - + file_test_id file_list - list of files to verify From 44884f5966d6afbeb1a2eeeab13b1eeb2d161a67 Mon Sep 17 00:00:00 2001 From: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:17:54 -0400 Subject: [PATCH 62/64] Add telemetry_logging role (#124) (#138) --- roles/telemetry_logging/README.md | 53 +++++++++++++++++++ roles/telemetry_logging/meta/main.yml | 53 +++++++++++++++++++ .../telemetry_logging/tasks/journal_tests.yml | 10 ++++ roles/telemetry_logging/tasks/main.yml | 5 ++ 4 files changed, 121 insertions(+) create mode 100644 roles/telemetry_logging/README.md create mode 100644 roles/telemetry_logging/meta/main.yml create mode 100644 roles/telemetry_logging/tasks/journal_tests.yml create mode 100644 roles/telemetry_logging/tasks/main.yml diff --git a/roles/telemetry_logging/README.md b/roles/telemetry_logging/README.md new file mode 100644 index 00000000..b9616c9e --- /dev/null +++ b/roles/telemetry_logging/README.md @@ -0,0 +1,53 @@ +telemetry_logging +========= + +Test logging in Openstack + +Requirements +------------ + +Role Variables +-------------- + + For journal_tests.yml + + identifiers_test_id + - polarion id for test + identifiers_list + - Lists identifier strings to look for in the journalctl of the compute nodes + + +Dependencies +------------ + +Openstack on Openshift deployed and logging enabled for Openstack + +Example Playbook +---------------- + +Each tasks/playbook.yml should be called independently via "ansible.builtin.import_role" with appropriate vars passed: + +- name: "Verify logging journalctl identifiers" + hosts: computes + gather_facts: no + vars: + identifiers_test_id: "RHOSO-12681" + identifiers_list: + - ceilometer_agent_compute + - nova_compute + + tasks: + - name: "Verify journalctl logging identifiers" + ansible.builtin.import_role: + name: telemetry_logging + + +License +------- + +Apache 2 + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/telemetry_logging/meta/main.yml b/roles/telemetry_logging/meta/main.yml new file mode 100644 index 00000000..8c72ad66 --- /dev/null +++ b/roles/telemetry_logging/meta/main.yml @@ -0,0 +1,53 @@ +--- +galaxy_info: + author: Alex Yefimov + description: Tests that logging is set up as expected in OpenSTack running on OpenShift + company: Red Hat + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: Apache-2.0 + + min_ansible_version: "2.1" + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/telemetry_logging/tasks/journal_tests.yml b/roles/telemetry_logging/tasks/journal_tests.yml new file mode 100644 index 00000000..60b44a9f --- /dev/null +++ b/roles/telemetry_logging/tasks/journal_tests.yml @@ -0,0 +1,10 @@ +--- +- name: Get journals + ansible.builtin.shell: + cmd: + tstamp=$(date -d '30 minute ago' "+%Y-%m-%d %H:%M:%S") + journalctl -t "{{ item }}" --no-pager -S "${tstamp}" | wc -l + register: journal_wc + changed_when: false + failed_when: + - journal_wc.stdout | int <= 1 diff --git a/roles/telemetry_logging/tasks/main.yml b/roles/telemetry_logging/tasks/main.yml new file mode 100644 index 00000000..2d43bcae --- /dev/null +++ b/roles/telemetry_logging/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- name: "Verify journal entries - {{ journal_test_id }}" + when: journal_list is defined + ansible.builtin.include_tasks: "journal_tests.yml" + loop: "{{ identifiers_list }}" From ac94272cad6b6c7dd87828c8208aa3b5769a9c9f Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Wed, 14 Aug 2024 20:26:04 +0100 Subject: [PATCH 63/64] Fix syntax error: change_when -> changed_when --- roles/common/tasks/container_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/common/tasks/container_tests.yml b/roles/common/tasks/container_tests.yml index aba1e4e8..21a6b464 100644 --- a/roles/common/tasks/container_tests.yml +++ b/roles/common/tasks/container_tests.yml @@ -4,6 +4,6 @@ ansible.builtin.shell: cmd: | podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' - change_when: false + changed_when: false register: container_status failed_when: container_status.stdout != "Up" From a8891d4d12d4398b378b5f41a1ad093435980408 Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Mon, 19 Aug 2024 21:07:12 +0100 Subject: [PATCH 64/64] [common] Rename var: nspace -> pod_nspace, service_nspace --- roles/common/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index b43e321e..d8bd13f6 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -38,7 +38,7 @@ - name: "Verify pod - {{ pod_test_id }}" when: - pod_list is defined - - nspace is defined + - pod_nspace is defined - pod_status_str is defined ansible.builtin.include_tasks: "pod_tests.yml" loop: "{{ pod_list }}" @@ -54,7 +54,7 @@ - name: "Verify service - {{ service_test_id }}" when: - service_list is defined - - nspace is defined + - service_nspace is defined ansible.builtin.include_tasks: "service_tests.yml" loop: "{{ service_list }}"