diff --git a/.zuul.yaml b/.zuul.yaml index d2d0d3e6..50f68642 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -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 diff --git a/distributedcloud-client/tox.ini b/distributedcloud-client/tox.ini index 8cfb2311..b641f7f3 100644 --- a/distributedcloud-client/tox.ini +++ b/distributedcloud-client/tox.ini @@ -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} diff --git a/tools/gate/playbooks/fetch-coverage.yaml b/tools/gate/playbooks/fetch-coverage.yaml new file mode 100644 index 00000000..f79c390a --- /dev/null +++ b/tools/gate/playbooks/fetch-coverage.yaml @@ -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 diff --git a/tox.ini b/tox.ini index 2fa6b049..b98c27f9 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =