From c1677cd8a4001196a45fe5acdbfbfd02c419ca3b Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Mon, 2 Mar 2020 16:25:21 -0800 Subject: [PATCH] try-finally --- tools/run_tests/run_xds_tests.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index 044428add2a..bdf61d37d23 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -216,11 +216,13 @@ def test_backends_restart(gcp, backend_service, instance_group): wait_until_only_given_instances_receive_load(instance_names, _WAIT_FOR_STATS_SEC) stats = get_client_stats(_NUM_TEST_RPCS, _WAIT_FOR_STATS_SEC) - resize_instance_group(gcp, instance_group, 0) - wait_until_only_given_instances_receive_load([], - _WAIT_FOR_BACKEND_SEC, - allow_failures=True) - resize_instance_group(gcp, instance_group, num_instances) + try: + resize_instance_group(gcp, instance_group, 0) + wait_until_only_given_instances_receive_load([], + _WAIT_FOR_BACKEND_SEC, + allow_failures=True) + finally: + resize_instance_group(gcp, instance_group, num_instances) wait_for_healthy_backends(gcp, backend_service, instance_group) new_instance_names = get_instance_names(gcp, instance_group) wait_until_only_given_instances_receive_load(new_instance_names,