diff --git a/.zuul.yaml b/.zuul.yaml index 3169a5ed..fad8b108 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -28,7 +28,7 @@ override-checkout: main - name: github.com/openstack-k8s-operators/telemetry-operator override-checkout: main - irrelevant-files: + irrelevant-files: &irrelevant_files - .github/.* - ci/github/.* - callback_plugins/.* @@ -63,17 +63,22 @@ override-checkout: main - name: github.com/openstack-k8s-operators/telemetry-operator override-checkout: main - irrelevant-files: - - .github/.* - - ci/github/.* - - callback_plugins/.* - - README* - - .*/*.md + irrelevant-files: *irrelevant_files + + name: feature-verification-tests-noop + parent: noop + description: | + A job that always passes. Runs when there's a change to jobs that don't + need full zuul to run but still need to report a pass. + run: + - ci/noop.yml + files: *irrelevant_files - project: name: infrawatch/feature-verification-tests github-check: jobs: + - feature-verification-tests-noop - openstack-k8s-operators-content-provider: override-checkout: main - functional-tests-on-osp18 diff --git a/ci/github/test_logger.yml b/ci/github/test_logger.yml index 42b562a2..dd99f4e2 100644 --- a/ci/github/test_logger.yml +++ b/ci/github/test_logger.yml @@ -36,3 +36,9 @@ when: true fail: msg: "If the task fails, the status will be reported since there's a test ID." + + - name: "Set the name based on a var input" + set_fact: + testid: "RHOSO-1234" + - name: "run test with variable name - {{ testid }}" + debug: msg="test" diff --git a/ci/github/test_logger_expected b/ci/github/test_logger_expected index d33ad32c..e950d10d 100644 --- a/ci/github/test_logger_expected +++ b/ci/github/test_logger_expected @@ -6,3 +6,4 @@ RHELOSP-042=passed RHELOSP-043=passed RHELOSP-054=passed RHOSO-078=failed +RHOSO-1234=passed diff --git a/ci/noop.yml b/ci/noop.yml new file mode 100644 index 00000000..7243e77d --- /dev/null +++ b/ci/noop.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + tasks: + - ansible.builtin.debug: + msg: "Do nothing" diff --git a/ci/run_playbooks.yml b/ci/run_playbooks.yml index f0983bcb..e0f3b187 100644 --- a/ci/run_playbooks.yml +++ b/ci/run_playbooks.yml @@ -67,8 +67,6 @@ tags: - setup - - name: Run telemetry tests on OSP18 - block: - name: "Run telemetry tests playbook locally on the target host" ansible.builtin.shell: cmd: | @@ -80,13 +78,12 @@ ansible.builtin.copy: content: "{{ output.stdout }}" dest: "{{ logs_dir }}/ansible_run.log" - - - - name: Revert the version update - ansible.builtin.shell: - cmd: | - oc patch openstackversions controlplane --type json -p='[{"op": "replace", "path": "/spec/customContainerImages", "value": {} }]' - when: "{{ patch_openstackversions | bool }}" + always: + - name: Revert the version update + ansible.builtin.shell: + cmd: | + oc patch openstackversions controlplane --type json -p='[{"op": "replace", "path": "/spec/customContainerImages", "value": {} }]' + when: "{{ patch_openstackversions | bool }}" - name: Include report result ansible.builtin.include_tasks: diff --git a/roles/telemetry_autoscaling/README.md b/roles/telemetry_autoscaling/README.md index 29807cdd..f2eb2e6a 100644 --- a/roles/telemetry_autoscaling/README.md +++ b/roles/telemetry_autoscaling/README.md @@ -7,11 +7,29 @@ Requirements ------------ The following resources are required in the OpenStack cloud * network called public -* network called provate +* network called private * security group called basic with ssh and tcp enabled to the VMs * a flavor called m1.small * an image called cirros +Tests: +------ +Verify overcloud deployment for autoscaling + Test service API endpoints + Verify all the services are running on overcloud + Verify time-series database service is available +Using the heat service for autoscaling + Create an archive policy + Configure heat template for automatically scaling instances + Create the deployment template for heat to control instance scaling +Create stack deployment for autoscaling + Verify that the stack and resources are created + Verify that the alarms were created for the stack + Verify the deployment and metric resources exist for the stack +Testing and troubleshooting autoscaling + Verify that alarms are triggered with traffic + Verify that Orchestration service has scaled the instances + Role Variables -------------- diff --git a/roles/telemetry_autoscaling/tasks/main.yml b/roles/telemetry_autoscaling/tasks/main.yml index 5ded01d4..3b408cee 100644 --- a/roles/telemetry_autoscaling/tasks/main.yml +++ b/roles/telemetry_autoscaling/tasks/main.yml @@ -10,6 +10,12 @@ include_vars: "{{ item }}" with_items: "{{ vars_files }}" +- name: RHOSO-12666 Test services are enabled for autoscaling + when: metrics_backend == "prometheus" + ansible.builtin.include_tasks: + file: test_services.yml + tags: precheck + - name: Check pre-reqs for autoscaling ansible.builtin.include_tasks: file: verify_autoscaling.yml diff --git a/roles/telemetry_autoscaling/tasks/test_services.yml b/roles/telemetry_autoscaling/tasks/test_services.yml new file mode 100644 index 00000000..94c199b1 --- /dev/null +++ b/roles/telemetry_autoscaling/tasks/test_services.yml @@ -0,0 +1,35 @@ +--- +# Verify Orchestration (heat) and telemetry services resources are ready for autoscaling + +- name: Verify that custom resource HEAT is ready + ansible.builtin.command: + cmd: | + oc get heat heat -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}' + register: result + failed_when: + - result.stdout != "True" + +- name: Verify that custom resource CEILOMETER is ready + ansible.builtin.command: + cmd: | + oc get ceilometer ceilometer -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}' + register: result + failed_when: + - result.stdout != "True" + +# - name: Verify that custom resource AUTOSCALING is ready +# It is returning an unexpected response and needs further debugging. will raise another PR to inspect this +# ansible.builtin.command: +# cmd: | +# oc get autoscaling autoscaling -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}' +# register: result +# failed_when: +# - result.stdout != "True" + +- name: Verify that custom resource METRICSTORAGE is ready + ansible.builtin.command: + cmd: | + oc get metricstorage metric-storage -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}' + register: result + failed_when: + - result.stdout != "True" diff --git a/roles/telemetry_autoscaling/tasks/verify_autoscaling.yml b/roles/telemetry_autoscaling/tasks/verify_autoscaling.yml index 9ae42a38..1813e795 100644 --- a/roles/telemetry_autoscaling/tasks/verify_autoscaling.yml +++ b/roles/telemetry_autoscaling/tasks/verify_autoscaling.yml @@ -40,3 +40,12 @@ {{ openstack_cmd }} metric status --fit-width; register: result failed_when: result.rc >= 1 + +# This works when using prometheus as the metrics backend +- name: Verify that PROMETHEUS is enabled + when: metrics_backend == "prometheus" + ansible.builtin.shell: | + {{ openstack_cmd }} metric query up --disable-rbac -c container -c value |grep -i "prometheus" |awk '{print $4}' + register: result + failed_when: + - result.stdout != "0" 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 }}"