From 6995dcd95877099415c0817537cb8e1fab8bc887 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 21 Jul 2021 13:42:19 -0700 Subject: [PATCH] Fix the url-map and backend creation conflict attempt 2 (#26748) * Move url-map creation down * Revert "Fix the backend service creation problem in xds k8s framework (#26713)" This reverts commit b4652844891a169ba749a04b79cdfc2dbd46d682. --- .../framework/xds_url_map_test_resources.py | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py b/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py index 7cc2bf93a6d..d1a8c59ad1c 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py @@ -198,14 +198,6 @@ class GcpResourceManager(metaclass=_MetaSingletonAndAbslFlags): logging.info('GcpResourceManager: skipping setup for strategy [%s]', self.strategy) return - # Construct UrlMap from test classes - # This is the step that mostly likely to go wrong. Lifting it to be the - # first task ensures fail fast. - aggregator = _UrlMapChangeAggregator( - url_map_name=self.td.make_resource_name(self.td.URL_MAP_NAME)) - for test_case_class in test_case_classes: - aggregator.apply_change(test_case_class) - final_url_map = aggregator.get_map() # Clean up debris from previous runs self._pre_cleanup() # Start creating GCP resources @@ -219,6 +211,12 @@ class GcpResourceManager(metaclass=_MetaSingletonAndAbslFlags): # Backend Services self.td.create_backend_service() self.td.create_alternative_backend_service() + # Construct UrlMap from test classes + aggregator = _UrlMapChangeAggregator( + url_map_name=self.td.make_resource_name(self.td.URL_MAP_NAME)) + for test_case_class in test_case_classes: + aggregator.apply_change(test_case_class) + final_url_map = aggregator.get_map() # UrlMap self.td.create_url_map_with_content(final_url_map) # Target Proxy @@ -266,10 +264,11 @@ class GcpResourceManager(metaclass=_MetaSingletonAndAbslFlags): @functools.lru_cache(None) def default_backend_service(self) -> str: """Returns default backend service URL.""" - return self.td.make_resource_name(self.td.BACKEND_SERVICE_NAME) + self.td.load_backend_service() + return self.td.backend_service.url @functools.lru_cache(None) def alternative_backend_service(self) -> str: """Returns alternative backend service URL.""" - return self.td.make_resource_name( - self.td.ALTERNATIVE_BACKEND_SERVICE_NAME) + self.td.load_alternative_backend_service() + return self.td.alternative_backend_service.url