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 b465284489.
reviewable/pr26751/r1
Lidi Zheng 3 years ago committed by GitHub
parent a10a5bf655
commit 6995dcd958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      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

Loading…
Cancel
Save