diff --git a/tools/run_tests/xds_k8s_test_driver/framework/xds_gamma_testcase.py b/tools/run_tests/xds_k8s_test_driver/framework/xds_gamma_testcase.py index ab8d6529494..0d86a15bb76 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/xds_gamma_testcase.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/xds_gamma_testcase.py @@ -130,6 +130,8 @@ class GammaXdsKubernetesTestCase(xds_k8s_testcase.RegularXdsKubernetesTestCase): # To compensate for this, we double the timeout for GAMMA tests. return self._start_test_client( server_target, - wait_for_active_channel_timeout=datetime.timedelta(minutes=10), + wait_for_server_channel_ready_timeout=datetime.timedelta( + minutes=10 + ), **kwargs, ) diff --git a/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py b/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py index b3779e3842b..55743de13b2 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py @@ -739,6 +739,30 @@ class IsolatedXdsKubernetesTestCase( force=self.force_cleanup, force_namespace=self.force_cleanup ) + def _start_test_client( + self, + server_target: str, + *, + wait_for_active_ads: bool = True, + wait_for_server_channel_ready: bool = True, + wait_for_active_ads_timeout: Optional[_timedelta] = None, + wait_for_server_channel_ready_timeout: Optional[_timedelta] = None, + **kwargs, + ) -> XdsTestClient: + test_client = self.client_runner.run( + server_target=server_target, **kwargs + ) + if wait_for_active_ads: + test_client.wait_for_active_xds_channel( + xds_server_uri=self.xds_server_uri, + timeout=wait_for_active_ads_timeout, + ) + if wait_for_server_channel_ready: + test_client.wait_for_server_channel_ready( + timeout=wait_for_server_channel_ready_timeout, + ) + return test_client + class RegularXdsKubernetesTestCase(IsolatedXdsKubernetesTestCase): """Regular test case base class for testing PSM features in isolation.""" @@ -822,26 +846,6 @@ class RegularXdsKubernetesTestCase(IsolatedXdsKubernetesTestCase): ) -> XdsTestClient: return self._start_test_client(test_server.xds_uri, **kwargs) - def _start_test_client( - self, - server_target: str, - *, - wait_for_active_ads_timeout: Optional[_timedelta] = None, - wait_for_active_channel_timeout: Optional[_timedelta] = None, - **kwargs, - ) -> XdsTestClient: - test_client = self.client_runner.run( - server_target=server_target, **kwargs - ) - test_client.wait_for_active_xds_channel( - xds_server_uri=self.xds_server_uri, - timeout=wait_for_active_ads_timeout, - ) - test_client.wait_for_server_channel_ready( - timeout=wait_for_active_channel_timeout, - ) - return test_client - class AppNetXdsKubernetesTestCase(RegularXdsKubernetesTestCase): td: TrafficDirectorAppNetManager @@ -964,12 +968,12 @@ class SecurityXdsKubernetesTestCase(IsolatedXdsKubernetesTestCase): wait_for_server_channel_ready=True, **kwargs, ) -> XdsTestClient: - test_client = self.client_runner.run( - server_target=test_server.xds_uri, secure_mode=True, **kwargs + return self._start_test_client( + server_target=test_server.xds_uri, + wait_for_server_channel_ready=wait_for_server_channel_ready, + secure_mode=True, + **kwargs, ) - if wait_for_server_channel_ready: - test_client.wait_for_server_channel_ready() - return test_client def assertTestAppSecurity( self, diff --git a/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_testcase.py b/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_testcase.py index ba07e8e8d4c..25ef9ee9a6b 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_testcase.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_testcase.py @@ -479,6 +479,9 @@ class XdsUrlMapTestCase( super().run(result) def test_client_config(self): + self.test_client.wait_for_active_xds_channel( + xds_server_uri=GcpResourceManager().xds_server_uri, + ) retryer = retryers.constant_retryer( wait_fixed=datetime.timedelta( seconds=_URL_MAP_PROPAGATE_CHECK_INTERVAL_SEC