From 34787d788bd495ee13b9d0f95c4c0e456ca2bd3a Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Thu, 12 Sep 2024 20:00:04 +0100 Subject: [PATCH] [zuul] Add logging job to run telemetry_logging test role (#140) * [zuul] Add logging test job Add a job that runs the telemetry_logging role against an openstack cloud. * custom_logger: check for results for a host before creating the summary --------- Co-authored-by: Alex Yefimov <126113326+ayefimov-1@users.noreply.github.com> --- .zuul.yaml | 19 +++++++++++++++++-- callback_plugins/custom_logger.py | 7 +++++++ ci/logging_tests_computes.yml | 17 +++++++++++++++++ ci/vars-logging-test.yml | 8 ++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 ci/logging_tests_computes.yml create mode 100644 ci/vars-logging-test.yml diff --git a/.zuul.yaml b/.zuul.yaml index 62c2773d..f2789b2e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -12,7 +12,7 @@ - "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/vars-functional-test.yml" roles: - zuul: github.com/openstack-k8s-operators/ci-framework - required-projects: + required-projects: &required_projects - name: github.com/infrawatch/service-telemetry-operator - name: openstack-k8s-operators/ci-framework override-checkout: main @@ -35,6 +35,21 @@ - README* - .*/*.md +- job: + name: functional-logging-tests-osp18 + parent: telemetry-operator-multinode-logging + description: | + Run the logging functional tests on osp18 + vars: + cifmw_extras: + - "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir }}/scenarios/centos-9/multinode-ci.yml" + - "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/telemetry-operator'].src_dir }}/ci/vars-logging.yml" + - "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/vars-logging-test.yml" + roles: + - zuul: github.com/openstack-k8s-operators/ci-framework + required-projects: *required_projects + irrelevant-files: *irrelevant_files + - job: name: feature-verification-tests-noop parent: noop @@ -45,7 +60,6 @@ - ci/noop.yml files: *irrelevant_files - - project: name: infrawatch/feature-verification-tests github-check: @@ -54,3 +68,4 @@ - openstack-k8s-operators-content-provider: override-checkout: main - functional-tests-on-osp18 + - functional-logging-tests-osp18 diff --git a/callback_plugins/custom_logger.py b/callback_plugins/custom_logger.py index 19bc706f..665b87ed 100644 --- a/callback_plugins/custom_logger.py +++ b/callback_plugins/custom_logger.py @@ -76,6 +76,13 @@ def log_task_result(self, host, result, task_name): def log_summary_results(self, host): file_path = os.path.join(self.output_dir, f"summary_results.log") + + # Make sure that the there is a result for the host, or else we get + # errors referencing the results dict later + if not self.results.get(host): + print("The host %s does not have any results" % host) + return + with open(file_path, 'w') as f: f.write(f"Host: {host}\n") f.write(f"Tasks Succeeded: {self.results[host]['passed']}\n") diff --git a/ci/logging_tests_computes.yml b/ci/logging_tests_computes.yml new file mode 100644 index 00000000..717de0d1 --- /dev/null +++ b/ci/logging_tests_computes.yml @@ -0,0 +1,17 @@ +--- +- name: "Verify logging journalctl identifiers" + hosts: computes + gather_facts: true + ignore_errors: true + environment: + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" + PATH: "{{ cifmw_path }}" + vars: + journal_test_id: "RHOSO-12681" + journal_list: + - ceilometer_agent_compute + - nova_compute + tasks: + - name: "Verify journalctl logging identifiers" + ansible.builtin.import_role: + name: telemetry_logging diff --git a/ci/vars-logging-test.yml b/ci/vars-logging-test.yml new file mode 100644 index 00000000..70ea1ba1 --- /dev/null +++ b/ci/vars-logging-test.yml @@ -0,0 +1,8 @@ +--- +post_deploy_00_fvt_logging_computes: + source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/logging_tests_computes.yml" + config_file: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/ansible.cfg" + type: playbook +post_deploy_99_collect_results: + source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/report_result.yml" + type: playbook