Skip to content

Commit

Permalink
Merge branch 'origin/master' into efoley_custom_junit_update_configur…
Browse files Browse the repository at this point in the history
…ation_options
  • Loading branch information
elfiesmelfie committed Oct 23, 2024
2 parents b98eedd + 12c154b commit 3f2c8a5
Show file tree
Hide file tree
Showing 22 changed files with 614 additions and 29 deletions.
18 changes: 18 additions & 0 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@
- ci/noop.yml
files: *irrelevant_files

- job:
name: functional-graphing-tests-osp18
parent: telemetry-operator-multinode-autoscaling
description: |
Run the UI Graphing test on osp18.
vars:
cifmw_run_tests: false
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-autoscaling.yml"
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/vars-graphing-test.yml"
roles:
- zuul: github.com/openstack-k8s-operators/ci-framework
required-projects: *required_projects
irrelevant-files: *irrelevant_files


- project:
name: infrawatch/feature-verification-tests
github-check:
Expand All @@ -69,3 +86,4 @@
override-checkout: main
- functional-tests-on-osp18
- functional-logging-tests-osp18
- functional-graphing-tests-osp18
23 changes: 3 additions & 20 deletions callback_plugins/custom_junit.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def __init__(self):
def _finish_task(self, status, result):
""" record the results of a task for a single host """
task_uuid = result._task._uuid

if hasattr(result, '_host'):
host_uuid = result._host._uuid
host_name = result._host.name
Expand All @@ -81,7 +80,7 @@ def _finish_task(self, status, result):
if self._test_case_prefix in task_data.name:
task_data.add_host(HostData(host_uuid, host_name, status, result))

# This bit is new
# Debugging
if task_data.name.startswith(self._test_case_prefix):
print(f"This task ({task_data.name}) starts with the test_prefix({self._test_case_prefix})")
if self._test_case_prefix in task_data.name:
Expand All @@ -90,45 +89,30 @@ def _finish_task(self, status, result):
print(f"This task ({task_data.name}) failed, but may not be reported")

def mutate_task_name(self, task_name):
#print("enter mutate_task_name(task_name=%s)" % task_name)

# Debugging
if not self._test_case_prefix in task_name:
print("task_name (%s) does not contain prefix (%s)" % (task_name, self._test_case_prefix))

new_name = task_name
new_name = new_name.split("\n")[0] # only use the first line, so we can include IDs and additional description
#print("%s\t(take the first line of the task name)" % new_name)

# this covers when a task is included, but the including task is the one that is the test
new_name = new_name.split(":")[-1] # only provide the last part of the name when the role name is included
#print("%s\t(split at :, take last element)" % new_name)

if len(self._test_case_prefix) > 0:
# this one may not be needed...
new_name = new_name.split(self._test_case_prefix)[-1] # remove the test prefix and everything before it
#print("%s\t(remove test prefix)" % new_name)

new_name = new_name.lower()
#print("%s\t(lowercase)" % new_name)

new_name = re.sub(r'\W', ' ', new_name) # replace all non-alphanumeric characters (except _) with a space
#print("%s (Replace non-alphanumerics with a space)" % new_name)

new_name = re.sub(r'(^\W*|\W*$)', '', new_name) # trim any trailing or leading non-alphanumeric characters
#print("%s\t(trim leading or trailing characters" % new_name)

new_name = re.sub(r' +', '_', new_name) # replace any number of spaces with _
#print("%s\t(spaces -> _)" % new_name)

#print("exit mutate_task_name")
return new_name

def _build_test_case(self, task_data, host_data):
"""
This is used in generate_report. The task_data and host data will get passed.
"""
# Use the original task name to define the final name
#new_name = self.mutate_task_name(task_data.name)

print("%s\t(task_name, pre-_build_test_case)" % task_data.name)
tc = super()._build_test_case(task_data, host_data)
Expand All @@ -137,11 +121,10 @@ def _build_test_case(self, task_data, host_data):

print("%s\t(tc.name, post-mutate_task_name)" % tc.name)

# I don't want these properties for now; I may be able to omit them with a config option
# These can be able to omit with a config option
# These two control whether testcases contain the system_out and
# system_err elements that show STDOUT and STDERR
tc.system_out = None
tc.system_err = None

tc.classname = "openstack-observability"
return tc
4 changes: 3 additions & 1 deletion callback_plugins/custom_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ def playbook_on_stats(self, stats):

def log_task_result(self, host, result, task_name):
# test_run_result.out only interested in the test tasks, not setup or debug.
if "RHELOSP" in task_name or "RHOSO" in task_name:
if "RHELOSP" in task_name or "RHOSO" in task_name or "UI" in task_name:
if "RHELOSP" in task_name:
test_id = re.search(r'RHELOSP\S*', task_name).group(0)
elif "RHOSO" in task_name:
test_id = re.search(r'RHOSO\S*', task_name).group(0)
elif "UI" in task_name:
test_id = re.search(r'UI\S*', task_name).group(0)

file_path = os.path.join(self.output_dir, f"test_run_result.out")
test_result_message = self.MSG_FORMAT.format(task=test_id, status=result)
Expand Down
1 change: 1 addition & 0 deletions ci/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ roles_path = ../roles:/usr/share/ansible/roles:/etc/ansible/roles:~/.ansible/rol

[custom_logger]
output_dir = /$HOME

5 changes: 5 additions & 0 deletions ci/logging_tests_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: Run the compute node tests
ansible.builtin.import_playbook: logging_tests_computes.yml

- name: Run the controller tests
ansible.builtin.import_playbook: logging_tests_controller.yml
132 changes: 132 additions & 0 deletions ci/logging_tests_controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
- name: "Verify logging projects, endpoints, credentials, nodes, pods, services, manifests and subscriptions"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOS0-12672"
common_pod_status_str: "Running"
common_pod_nspace: openstack-operators
common_pod_list:
- telemetry-operator-controller-manager
- dataplane-operator-controller-manager
common_project_test_id: "RHOSO-12668"
common_project_list:
- openshift-openstack-infra
- openshift
- openstack-operators
- openshift-logging
tasks:
- name: "Verify projects exist"
ansible.builtin.import_role:
name: common


- name: "Verify logging pods are running in openstack"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12752"
common_pod_status_str: "Running"
common_pod_nspace: openstack
common_pod_list:
- openstackclient
tasks:
- name: "Verify Running Pods"
ansible.builtin.import_role:
name: common


- name: "Verify logging pods are running in openshift-operators-redhat"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12673"
common_pod_status_str: "Running"
common_pod_nspace: openshift-operators-redhat
common_pod_list:
- loki-operator-controller-manager

tasks:
- name: "Verify Pods running"
ansible.builtin.import_role:
name: common

- name: "Verify logging pods are running in openshift-logging"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12676"
common_pod_status_str: "Running"
common_pod_nspace: openshift-logging
common_pod_list:
- cluster-logging-operator
- collector
- logging-loki-compactor
- logging-loki-distributor
#- logging-loki-gateway
- logging-loki-index-gateway
- logging-loki-ingester
- logging-loki-querier
- logging-loki-query-frontend
- logging-view-plugin

### see JIRA LOG-5431 if pods not running
tasks:
- name: "Verify Pods running"
ansible.builtin.import_role:
name: common

- name: "Verify logging pods are running in minio-dev"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12674"
common_pod_status_str: "Running"
common_pod_nspace: minio-dev
common_pod_list:
- minio

tasks:
- name: "Run pod running tests"
ansible.builtin.import_role:
name: common


- name: "Verify logging pods have complete status in openstack"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12679"
common_pod_nspace: openstack
common_pod_status_str: "Completed"
common_pod_list:
- logging-edpm-deployment-openstack-edpm-ipam
tasks:
- name: "Run pods completed tests"
ansible.builtin.import_role:
name: common

12 changes: 6 additions & 6 deletions ci/report_result.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Create the output files
- name: "Create the output files"
hosts:
- controller
vars_files:
Expand All @@ -11,15 +11,15 @@
state: directory
mode: "0755"

- name: Run the log file collection
- name: "Run the log file collection"
hosts:
- controller
- compute
gather_facts: true
vars_files:
- vars/common.yml
tasks:
- name: "Where is that XML file!?"
- name: "Find the XML file"
ansible.builtin.shell:
cmd: |
find ~/.ansible.log/ -name *.xml
Expand All @@ -31,7 +31,7 @@
var: xml_file_list.stdout_lines
ignore_errors: true

- name: Collect the XML files, renaming them for the host that they are collected from
- name: "Collect the XML files, renaming them for the host that they are collected from"
delegate_to: controller
ansible.builtin.copy:
remote_src: true
Expand All @@ -40,14 +40,14 @@
with_items: "{{ xml_file_list.stdout_lines }}"
when: xml_file_list.stdout_lines | length != 0

- name: Collect the custom_logger results
- name: "Collect the custom_logger results"
delegate_to: controller
ansible.builtin.copy:
remote_src: true
src: "{{ ansible_env.HOME }}/test_run_result.out"
dest: "{{ logs_dir }}/test_run_result.out"

- name: Collect the results summary
- name: "Collect the results summary"
delegate_to: controller
ansible.builtin.copy:
remote_src: true
Expand Down
40 changes: 40 additions & 0 deletions ci/run_graphing_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: "Run functional test playbooks"
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars_files:
- vars/common.yml
tasks:
- block:
- name: "Enable Graphing"
ansible.builtin.shell:
cmd: |
oc patch oscp/controlplane --type='json' -p '[{"op": "replace", "path": "/spec/telemetry/template/metricStorage/dashboardsEnabled", "value":true}]'
register: oscp_change
changed_when: false

- name: Wait until the oscp is resolved the changes to continue
ansible.builtin.shell:
cmd: |
oc get oscp | grep "Setup complete"
retries: 24
timeout: 5
until: output.stdout_lines | length == 1
register: output

- name: "Run Graphing Console UI tests"
ansible.builtin.import_role:
name: telemetry_graphing
ignore_errors: true

always:
- name: "Revert the oscp/controlplane change"
ansible.builtin.shell:
cmd: |
oc patch oscp/controlplane --type='json' -p '[{"op": "replace", "path": "/spec/telemetry/template/metricStorage/dashboardsEnabled", "value":false}]'
9 changes: 9 additions & 0 deletions ci/vars-graphing-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# temp: skip os-net-setup
cifmw_os_net_setup_config: []
post_deploy_00_run_graphing_test:
source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/run_graphing_test.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
5 changes: 3 additions & 2 deletions ci/vars-logging-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
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"
# pre_tests or post_tests are also options for when the FVT roles are run
post_deploy_00_fvt_logging:
source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/logging_tests_all.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:
Expand Down
Loading

0 comments on commit 3f2c8a5

Please sign in to comment.