aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/interop_matrix/run_interop_matrix_tests.py
diff options
context:
space:
mode:
authorGravatar Adele Zhou <adelez@google.com>2017-10-04 15:53:03 -0700
committerGravatar Adele Zhou <adelez@google.com>2017-10-06 17:49:32 -0700
commite6b9c787c0314d31060c0c4547bf12e087fb4e93 (patch)
treeeaa3664ef35ab65f3a40d4d7e0f26a1fb6b7349a /tools/interop_matrix/run_interop_matrix_tests.py
parent00181bd0369a34c59532737dd1a6c57fb6065331 (diff)
Exit 1 when there are failures.
Diffstat (limited to 'tools/interop_matrix/run_interop_matrix_tests.py')
-rwxr-xr-xtools/interop_matrix/run_interop_matrix_tests.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/interop_matrix/run_interop_matrix_tests.py b/tools/interop_matrix/run_interop_matrix_tests.py
index 4315c8277d..510bc7124d 100755
--- a/tools/interop_matrix/run_interop_matrix_tests.py
+++ b/tools/interop_matrix/run_interop_matrix_tests.py
@@ -48,9 +48,8 @@ argp.add_argument('-j', '--jobs', default=multiprocessing.cpu_count(), type=int)
argp.add_argument('--gcr_path',
default='gcr.io/grpc-testing',
help='Path of docker images in Google Container Registry')
-
argp.add_argument('--release',
- default='master',
+ default='all',
choices=['all', 'master'] + _RELEASES,
help='Release tags to test. When testing all '
'releases defined in client_matrix.py, use "all".')
@@ -94,14 +93,15 @@ def find_all_images_for_lang(lang):
for runtime in client_matrix.LANG_RUNTIME_MATRIX[lang]:
image_path = '%s/grpc_interop_%s' % (args.gcr_path, runtime)
output = subprocess.check_output(['gcloud', 'beta', 'container', 'images',
- 'list-tags', '--format=json', image_path])
+ 'list-tags', '--format=json', image_path])
docker_image_list = json.loads(output)
# All images should have a single tag or no tag.
+ # TODO(adelez): Remove tagless images.
tags = [i['tags'][0] for i in docker_image_list if i['tags']]
jobset.message('START', 'Found images for %s: %s' % (image_path, tags),
do_newline=True)
skipped = len(docker_image_list) - len(tags)
- jobset.message('START', 'Skipped images (no-tag/unknown-tag): %d' % skipped,
+ jobset.message('SKIPPED', 'Skipped images (no-tag/unknown-tag): %d' % skipped,
do_newline=True)
# Filter tags based on the releases.
images[runtime] = [(tag,'%s:%s' % (image_path,tag)) for tag in tags if
@@ -148,6 +148,7 @@ def run_tests_for_lang(lang, runtime, images):
images is a list of (<release-tag>, <image-full-path>) tuple.
"""
+ total_num_failures = 0
for image_tuple in images:
release, image = image_tuple
jobset.message('START', 'Testing %s' % image, do_newline=True)
@@ -161,6 +162,7 @@ def run_tests_for_lang(lang, runtime, images):
maxjobs=args.jobs)
if num_failures:
jobset.message('FAILED', 'Some tests failed', do_newline=True)
+ total_num_failures += num_failures
else:
jobset.message('SUCCESS', 'All tests passed', do_newline=True)
@@ -170,6 +172,9 @@ def run_tests_for_lang(lang, runtime, images):
'grpc_interop_matrix',
'%s__%s %s'%(lang,runtime,release),
str(uuid.uuid4()))
+
+ return total_num_failures
+
_docker_images_cleanup = []
def cleanup():
@@ -180,9 +185,14 @@ def cleanup():
atexit.register(cleanup)
languages = args.language if args.language != ['all'] else _LANGUAGES
+total_num_failures = 0
for lang in languages:
docker_images = find_all_images_for_lang(lang)
for runtime in sorted(docker_images.keys()):
- run_tests_for_lang(lang, runtime, docker_images[runtime])
+ total_num_failures += run_tests_for_lang(lang, runtime, docker_images[runtime])
report_utils.create_xml_report_file(_xml_report_tree, args.report_file)
+
+if total_num_failures:
+ sys.exit(1)
+sys.exit(0)