Create Zuul job for unit test coverage

Creates a non-voting Zuul job that runs the tox coverage test.
Current coverage is 75%, so it's configured to fail if less than 75%.
This value should be updated whenever the coverage increases.

The full coverage report is copied to the zuul logs folder, providing
an easy way to view and share the results.

Test plan:
1. PASS: Verify that Zuul runs the new job and that the reports are
   copied to the Zuul log output folder.

Story: 2011149
Task: 53657

Co-Authored-By: Raphael <Raphael.Lima@windriver.com>

Change-Id: I93b254a587a052e0f890799ed9d7f969915a91a2
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
This commit is contained in:
Gustavo Herzmann
2026-01-13 17:04:44 -03:00
parent 642b018a20
commit 97c94787a3
4 changed files with 34 additions and 2 deletions
+14
View File
@@ -11,6 +11,7 @@
- stx-distcloud-client-tox-py39
- stx-distcloud-client-tox-pylint
- stx-distcloud-client-tox-black
- stx-distcloud-client-tox-cover
gate:
jobs:
- openstack-tox-linters
@@ -18,6 +19,7 @@
- stx-distcloud-client-tox-py39
- stx-distcloud-client-tox-pylint
- stx-distcloud-client-tox-black
- stx-distcloud-client-tox-cover
post:
jobs:
- stx-distcloud-client-upload-git-mirror
@@ -62,6 +64,18 @@
tox_envlist: black_check
tox_extra_args: -c distributedcloud-client/tox.ini
- job:
name: stx-distcloud-client-tox-cover
parent: tox
description: Run coverage test for distcloud-client
nodeset: debian-bullseye
vars:
python_version: 3.9
tox_envlist: cover
tox_extra_args: -c distributedcloud-client/tox.ini
post-run: tools/gate/playbooks/fetch-coverage.yaml
voting: false
- job:
name: stx-distcloud-client-upload-git-mirror
parent: upload-git-mirror
+2 -2
View File
@@ -1,5 +1,5 @@
[tox]
envlist = py39,pep8,pylint,black_check
envlist = py39,pep8,pylint,black_check,cover
minversion = 4.4.0
skipsdist = True
toxworkdir = /tmp/{env:USER}_dc_client_tox
@@ -76,7 +76,7 @@ commands =
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
coverage report --fail-under=75
[testenv:debug]
commands = oslo_debug_helper {posargs}
+15
View File
@@ -0,0 +1,15 @@
---
- hosts: "{{ target_hosts | default('all') }}"
gather_facts: false
tasks:
- name: Collect coverage artifacts
synchronize:
src: "{{ zuul.project.src_dir }}/distributedcloud-client/{{ item }}"
dest: "{{ zuul.executor.log_root }}/{{ item }}"
mode: pull
copy_links: true
verify_host: true
loop:
- cover/
- .coverage
ignore_errors: true
+3
View File
@@ -33,6 +33,9 @@ description = Dummy environment to allow black to be run in subdir tox
[testenv:black_check]
description = Dummy environment to allow black_check to be run in subdir tox
[testenv:cover]
description = Dummy environment to allow cover to be run in subdir tox
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands =