From 11671b04073db623ba21be2b84e44bb8c0c987fb Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Tue, 24 Mar 2020 14:15:12 -0700 Subject: [PATCH 1/3] log exception and init client_process --- tools/run_tests/run_xds_tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index 1deac8db5a5..6e5b454e447 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -1069,6 +1069,7 @@ try: if not os.path.exists(log_dir): os.makedirs(log_dir) test_log_file = open(os.path.join(log_dir, _SPONGE_LOG_NAME), 'w+') + client_process = None try: client_process = subprocess.Popen(client_cmd, env=client_env, @@ -1106,6 +1107,7 @@ try: result.state = 'PASSED' result.returncode = 0 except Exception as e: + logger.error('Test case %s failed: %s' % (test_case, e)) result.state = 'FAILED' result.message = str(e) finally: From fb90989c7b7997c90b18a49b22c27239d441b65d Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Fri, 27 Mar 2020 16:00:34 -0700 Subject: [PATCH 2/3] fix format, exit(1) if any failures --- tools/run_tests/run_xds_tests.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index 6e5b454e447..61bd8889156 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -1063,6 +1063,7 @@ try: qps=args.qps)) test_results = {} + failed_tests = [] for test_case in args.test_case: result = jobset.JobResult() log_dir = os.path.join(_TEST_LOG_BASE_DIR, test_case) @@ -1107,7 +1108,8 @@ try: result.state = 'PASSED' result.returncode = 0 except Exception as e: - logger.error('Test case %s failed: %s' % (test_case, e)) + logger.error('Test case %s failed: %s', test_case, e) + failed_tests.append(test_case) result.state = 'FAILED' result.message = str(e) finally: @@ -1124,6 +1126,9 @@ try: _SPONGE_XML_NAME), suite_name='xds_tests', multi_target=True) + if failed_tests: + logger.error('Test case(s) %s failed', failed_tests) + sys.exit(1) finally: if not args.keep_gcp_resources: logger.info('Cleaning up GCP resources. This may take some time.') From 2c0a9c1ca8e8fc7d5ccf0069494449bd530b3313 Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Fri, 27 Mar 2020 18:26:12 -0700 Subject: [PATCH 3/3] fix duplicate logs --- tools/run_tests/run_xds_tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index 61bd8889156..041fcb4930e 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -39,7 +39,9 @@ logger = logging.getLogger() console_handler = logging.StreamHandler() formatter = logging.Formatter(fmt='%(asctime)s: %(levelname)-8s %(message)s') console_handler.setFormatter(formatter) +logger.handlers = [] logger.addHandler(console_handler) +logger.setLevel(logging.WARNING) _TEST_CASES = [ 'backends_restart',