From d782da39338de8c16e77738c6eefdeff547c99ee Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Thu, 2 Apr 2020 15:49:08 +0300 Subject: [PATCH] [ci] Restore osresources comparison script + temporary ignore gnocchi.metric resource Change-Id: I4ff5ed87fc67b27a2b15c1f065a1098e2989ad3b --- tests/ci/osresources.py | 21 +++++++++---------- .../roles/check-os-resources/tasks/main.yaml | 10 ++------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/tests/ci/osresources.py b/tests/ci/osresources.py index dc8ef409..0104427f 100755 --- a/tests/ci/osresources.py +++ b/tests/ci/osresources.py @@ -17,7 +17,6 @@ import argparse import json -import os import subprocess import sys @@ -542,6 +541,11 @@ def main(): type=argparse.FileType("r"), metavar="", help="cloud credentials in JSON format") + parser.add_argument("--fail", + action="store_true", + help="Return not zero code in case when some resources" + " left." + ) group = parser.add_mutually_exclusive_group(required=True) group.add_argument("--dump-list", type=argparse.FileType("w"), @@ -597,6 +601,9 @@ def main(): or resource["cls"] == "murano" + or (resource["cls"] == "gnocchi" + and resource["resource_name"] == "metric") + # Glance has issues with uWSGI integration... or resource["cls"] == "glance"): expected.append(resource) @@ -613,16 +620,8 @@ def main(): if expected: _print_tabular_resources(expected, "Added resources (expected)") - if any(changes): - # NOTE(andreykurilin): '1' return value will fail gate job. It is - # ok for changes to Rally project, but changes to other - # projects, which have rally job, should not be affected by - # this check, since in most cases resources are left due - # to wrong cleanup of a particular scenario. - print(os.environ.get("ZUUL_PROJECT")) - if os.environ.get("ZUUL_PROJECT") == "openstack/rally-openstack": - return 1 - return 0 + if any(changes) and args.fail: + return 1 return 0 diff --git a/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml b/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml index 218505b1..11c9fea3 100644 --- a/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml +++ b/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml @@ -3,15 +3,9 @@ become_user: stack shell: cmd: | - pip3 freeze | grep rally > /dev/null - if [ "$?" = "0" ]; then - PYTHON=python3 - else - PYTHON=python - fi - $PYTHON ./tests/ci/osresources.py --compare-with-list {{ rally_resources_at_start }} - args: + python3 ./tests/ci/osresources.py --compare-with-list {{ rally_resources_at_start }} {%- if zuul.project.name == "openstack/rally-openstack"%} --fail {% endif %} chdir: "{{ zuul.projects['opendev.org/openstack/rally-openstack'].src_dir }}" + register: command_result - name: Check results of listing resources