From 7adb0c3b4af709cac3b89da164180569535c226b Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 13 Jul 2022 11:04:12 +1000 Subject: [PATCH] upload-pypi: basic testing Very basic testing to include the ensure-twine and upload-pypi role. This really just does a syntax and sanity check. Change-Id: Ie40ec32b3b2ffc4646301c6e145c527fe6a3bae2 --- test-playbooks/python/upload-pypi.yaml | 30 ++++++++++++++++++++++++++ zuul-tests.d/python-jobs.yaml | 18 +++++++++++----- 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 test-playbooks/python/upload-pypi.yaml diff --git a/test-playbooks/python/upload-pypi.yaml b/test-playbooks/python/upload-pypi.yaml new file mode 100644 index 000000000..8587f1d8d --- /dev/null +++ b/test-playbooks/python/upload-pypi.yaml @@ -0,0 +1,30 @@ +- hosts: all + tasks: + + - name: Install twine + include_role: + name: ensure-twine + + - name: Setup role failure var + set_fact: + _role_failed: false + + - name: Wrap arg failure + block: + - name: Check for argument failure + include_role: + name: upload-pypi + vars: + pypi_info: + username: a_user + api_token: a_token + + rescue: + - name: Mark role as failed + set_fact: + _role_failed: true + + - name: Check role failed + fail: + msg: 'upload-pypi did not fail as it should' + when: _role_failed is not true diff --git a/zuul-tests.d/python-jobs.yaml b/zuul-tests.d/python-jobs.yaml index 58db4c995..782f21426 100644 --- a/zuul-tests.d/python-jobs.yaml +++ b/zuul-tests.d/python-jobs.yaml @@ -323,11 +323,6 @@ - zuul/zuul - zuul/nodepool -# -* AUTOGENERATED *- -# The following project section is autogenerated by -# tox -e update-test-platforms -# Please re-run to generate new job lists - - job: name: zuul-jobs-test-fetch-tox-output description: Test the fetch-tox-output @@ -412,6 +407,18 @@ vars: zuul_use_fetch_output: false +- job: + name: zuul-jobs-test-upload-pypi + description: Test the upload-pypi role + files: + - roles/upload-pypi/.* + run: test-playbooks/python/upload-pypi.yaml + +# -* AUTOGENERATED *- +# The following project section is autogenerated by +# tox -e update-test-platforms +# Please re-run to generate new job lists + - project: check: jobs: &id001 @@ -452,6 +459,7 @@ - zuul-jobs-test-fetch-sphinx-output-synchronize - zuul-jobs-test-fetch-sphinx-tarball-with-zuul-output - zuul-jobs-test-fetch-sphinx-tarball-synchronize + - zuul-jobs-test-upload-pypi gate: jobs: *id001 periodic-weekly: