[ci] Fail job in case if there are undeleted resources

Change-Id: I8c33f6e97869e0e1398e0e9a19225073022c1dea
This commit is contained in:
Andrey Kurilin 2017-07-03 15:24:27 +03:00
parent 0550fe2f89
commit 1152c18a92

View File

@ -18,6 +18,7 @@
import argparse import argparse
import json import json
import os
import subprocess import subprocess
import sys import sys
@ -529,7 +530,8 @@ def main():
changes = resources.compare(with_list=given_list) changes = resources.compare(with_list=given_list)
removed, added = changes removed, added = changes
# Cinder has a feature - cache images. let's filter such volumes # Cinder has a feature - cache images for speeding-up time of creating
# volumes from images. let's put such cache-volumes into expected list
volume_names = [ volume_names = [
"image-%s" % i["id"]["id"] for i in given_list "image-%s" % i["id"]["id"] for i in given_list
if i["cls"] == "glance" and i["resource_name"] == "image"] if i["cls"] == "glance" and i["resource_name"] == "image"]
@ -537,15 +539,20 @@ def main():
# filter out expected additions # filter out expected additions
expected = [] expected = []
for resource in added: for resource in added:
if ((resource["cls"] == "keystone" and if (
resource["resource_name"] == "role" and (resource["cls"] == "keystone" and
resource["id"].get("name") == "_member_") or resource["resource_name"] == "role" and
(resource["cls"] == "neutron" and resource["id"].get("name") == "_member_") or
resource["resource_name"] == "security_group" and
resource["id"].get("name") == "default") or (resource["cls"] == "neutron" and
(resource["cls"] == "cinder" and resource["resource_name"] == "security_group" and
resource["resource_name"] == "volume" and resource["id"].get("name") == "default") or
resource["id"].get("name") in volume_names)):
(resource["cls"] == "cinder" and
resource["resource_name"] == "volume" and
resource["id"].get("name") in volume_names) or
resource["cls"] == "murano"):
expected.append(resource) expected.append(resource)
for resource in expected: for resource in expected:
@ -561,7 +568,14 @@ def main():
_print_tabular_resources(expected, "Added resources (expected)") _print_tabular_resources(expected, "Added resources (expected)")
if any(changes): if any(changes):
return 0 # `1' will fail gate job # 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.
if os.environ.get("ZUUL_PROJECT") == "openstack/rally":
return 1
return 0
return 0 return 0