diff options
Diffstat (limited to 'tools/run_tests/python_utils')
-rwxr-xr-x | tools/run_tests/python_utils/dockerjob.py | 20 | ||||
-rw-r--r-- | tools/run_tests/python_utils/report_utils.py | 11 |
2 files changed, 23 insertions, 8 deletions
diff --git a/tools/run_tests/python_utils/dockerjob.py b/tools/run_tests/python_utils/dockerjob.py index 0869c5cee9..709fc121a9 100755 --- a/tools/run_tests/python_utils/dockerjob.py +++ b/tools/run_tests/python_utils/dockerjob.py @@ -70,6 +70,23 @@ def docker_mapped_port(cid, port, timeout_seconds=15): (port, cid)) +def wait_for_healthy(cid, shortname, timeout_seconds): + """Wait timeout_seconds for the container to become healthy""" + started = time.time() + while time.time() - started < timeout_seconds: + try: + output = subprocess.check_output( + ['docker', 'inspect', '--format="{{.State.Health.Status}}"', cid], + stderr=_DEVNULL) + if output.strip('\n') == 'healthy': + return + except subprocess.CalledProcessError as e: + pass + time.sleep(1) + raise Exception('Timed out waiting for %s (%s) to pass health check' % + (shortname, cid)) + + def finish_jobs(jobs): """Kills given docker containers and waits for corresponding jobs to finish""" for job in jobs: @@ -113,6 +130,9 @@ class DockerJob: def mapped_port(self, port): return docker_mapped_port(self._container_name, port) + def wait_for_healthy(self, timeout_seconds): + wait_for_healthy(self._container_name, self._spec.shortname, timeout_seconds) + def kill(self, suppress_failure=False): """Sends kill signal to the container.""" if suppress_failure: diff --git a/tools/run_tests/python_utils/report_utils.py b/tools/run_tests/python_utils/report_utils.py index 131772f55f..3b2b4f8712 100644 --- a/tools/run_tests/python_utils/report_utils.py +++ b/tools/run_tests/python_utils/report_utils.py @@ -80,10 +80,9 @@ def render_junit_xml_report(resultset, xml_report, suite_package='grpc', tree = ET.ElementTree(root) tree.write(xml_report, encoding='UTF-8') - def render_interop_html_report( client_langs, server_langs, test_cases, auth_test_cases, http2_cases, - http2_badserver_cases, client_langs_http2_badserver_cases, resultset, + http2_server_cases, resultset, num_failures, cloud_to_prod, prod_servers, http2_interop): """Generate HTML report for interop tests.""" template_file = 'tools/run_tests/interop/interop_html_report.template' @@ -99,9 +98,7 @@ def render_interop_html_report( sorted_test_cases = sorted(test_cases) sorted_auth_test_cases = sorted(auth_test_cases) sorted_http2_cases = sorted(http2_cases) - sorted_http2_badserver_cases = sorted(http2_badserver_cases) - sorted_client_langs_http2_badserver_cases = sorted( - client_langs_http2_badserver_cases) + sorted_http2_server_cases = sorted(http2_server_cases) sorted_client_langs = sorted(client_langs) sorted_server_langs = sorted(server_langs) sorted_prod_servers = sorted(prod_servers) @@ -111,9 +108,7 @@ def render_interop_html_report( 'test_cases': sorted_test_cases, 'auth_test_cases': sorted_auth_test_cases, 'http2_cases': sorted_http2_cases, - 'http2_badserver_cases': sorted_http2_badserver_cases, - 'client_langs_http2_badserver_cases': ( - sorted_client_langs_http2_badserver_cases), + 'http2_server_cases': sorted_http2_server_cases, 'resultset': resultset, 'num_failures': num_failures, 'cloud_to_prod': cloud_to_prod, |