From 1aed3ce715f89de1348e116b63676f8be717d7ed Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Fri, 26 Jul 2019 19:11:19 +0900 Subject: [PATCH] check-plugins job: convert the job to tox Previously check-plugins job runs a shell script in a playbook. This commit converts it into tox env so that developers can run the check job locally. This commit also improves the output of check_osc_commands. Change-Id: I280975f20b9dd5080bafb599440ed1c992648986 --- .zuul.yaml | 5 ++-- .../openstackclient-check-plugins/run.yaml | 19 --------------- tests/check_osc_commands.py | 24 +++++++++++-------- tests/install-siblings.sh | 3 +++ tox.ini | 15 ++++++++++++ 5 files changed, 35 insertions(+), 31 deletions(-) delete mode 100644 playbooks/openstackclient-check-plugins/run.yaml create mode 100644 tests/install-siblings.sh diff --git a/.zuul.yaml b/.zuul.yaml index f657714..9b62ccf 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,9 +1,10 @@ # from o-z-j/zuul.d/zuul-legacy-jobs.yaml - job: name: openstackclient-check-plugins - parent: unittests - run: playbooks/openstackclient-check-plugins/run.yaml + parent: openstack-tox timeout: 1800 + vars: + tox_envlist: osc_plugins required-projects: - openstack/openstackclient - x/pbrx diff --git a/playbooks/openstackclient-check-plugins/run.yaml b/playbooks/openstackclient-check-plugins/run.yaml deleted file mode 100644 index 8e8f3ec..0000000 --- a/playbooks/openstackclient-check-plugins/run.yaml +++ /dev/null @@ -1,19 +0,0 @@ -- hosts: all - name: Run openstackclient plugin check - tasks: - - - shell: - cmd: | - echo "------------------------------------------------------------" - virtualenv osc_plugins - osc_plugins/bin/pip install -e ../../x/pbrx - echo "------------------------------------------------------------" - osc_plugins/bin/pip install -c ../requirements/upper-constraints.txt -r requirements.txt - echo "------------------------------------------------------------" - osc_plugins/bin/pbrx install-siblings -c ../requirements/upper-constraints.txt $(find ../.. -mindepth 2 -maxdepth 2) - echo "------------------------------------------------------------" - osc_plugins/bin/pbr freeze - echo "------------------------------------------------------------" - osc_plugins/bin/openstack --version - osc_plugins/bin/python tests/check_osc_commands.py - chdir: /home/zuul/src/opendev.org/openstack/openstackclient diff --git a/tests/check_osc_commands.py b/tests/check_osc_commands.py index 7daf5c8..2e37dd6 100755 --- a/tests/check_osc_commands.py +++ b/tests/check_osc_commands.py @@ -18,6 +18,7 @@ plugins with the purpose of detecting duplicate commands. """ import pkg_resources +import pprint import traceback @@ -96,26 +97,29 @@ def find_duplicates(): if duplicate_cmds: print("Duplicate commands found...") - print(duplicate_cmds) + pprint.pprint(duplicate_cmds) return True if failed_cmds: print("Some commands failed to load...") - print(failed_cmds) + pprint.pprint(failed_cmds) return True overlap_cmds = _check_command_overlap(valid_cmds) + + print("Final set of commands...") + pprint.pprint(valid_cmds) + if overlap_cmds: print("WARNING: Some commands overlap...") - print(overlap_cmds) + pprint.pprint(overlap_cmds) # FIXME(stevemar): when we determine why commands are overlapping - # we can uncomment the line below. + # we can uncomment the line below. We return False until then. # return True - - # Safely return False here with the full set of commands - print("Final set of commands...") - print(valid_cmds) - print("Found no duplicate or overlapping commands, OK to merge!") - return False + return False + else: + # Safely return False here with the full set of commands + print("Found no duplicate or overlapping commands, OK to merge!") + return False def _check_command_overlap(valid_cmds): diff --git a/tests/install-siblings.sh b/tests/install-siblings.sh new file mode 100644 index 0000000..3715d13 --- /dev/null +++ b/tests/install-siblings.sh @@ -0,0 +1,3 @@ +#/bin/bash + +pbrx install-siblings -c ../requirements/upper-constraints.txt $(find ../.. -mindepth 2 -maxdepth 2) diff --git a/tox.ini b/tox.ini index 33c9dbe..73b018e 100644 --- a/tox.ini +++ b/tox.ini @@ -22,6 +22,21 @@ deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html +[testenv:osc_plugins] +basepython = python2.7 +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -r{toxinidir}/requirements.txt + ../../x/pbrx +whitelist_externals = + bash +commands = + # bash wrapper is required to handle a subshell of find. + bash ./tests/install-siblings.sh + pbr freeze + openstack --version + python tests/check_osc_commands.py + [flake8] ignore = E123,H405 show-source = True