@@ -44,6 +44,18 @@ def get_persistent_resource_status_running_mock():
4444 yield get_persistent_resource
4545
4646
47+ @pytest .fixture
48+ def get_persistent_resource_status_running_byosa_public_mock ():
49+ # Cluster with BYOSA and no peering
50+ with mock .patch .object (
51+ vertex_ray .util ._gapic_utils , "get_persistent_resource"
52+ ) as get_persistent_resource :
53+ get_persistent_resource .return_value = (
54+ tc .ClusterConstants .TEST_RESPONSE_RUNNING_1_POOL_BYOSA
55+ )
56+ yield get_persistent_resource
57+
58+
4759@pytest .fixture
4860def get_bearer_token_mock ():
4961 with mock .patch .object (
@@ -112,3 +124,27 @@ def test_job_submission_client_cluster_info_with_dashboard_address(
112124 _use_tls = True ,
113125 headers = tc .ClusterConstants .TEST_HEADERS ,
114126 )
127+
128+ @pytest .mark .usefixtures (
129+ "get_persistent_resource_status_running_byosa_public_mock" , "google_auth_mock"
130+ )
131+ def test_job_submission_client_cluster_info_with_cluster_name_byosa_public (
132+ self ,
133+ ray_get_job_submission_client_cluster_info_mock ,
134+ get_bearer_token_mock ,
135+ get_project_number_mock ,
136+ ):
137+ aiplatform .init (project = tc .ProjectConstants .TEST_GCP_PROJECT_ID )
138+
139+ vertex_ray .get_job_submission_client_cluster_info (
140+ tc .ClusterConstants .TEST_VERTEX_RAY_PR_ID
141+ )
142+ get_project_number_mock .assert_called_once_with (
143+ name = "projects/{}" .format (tc .ProjectConstants .TEST_GCP_PROJECT_ID )
144+ )
145+ get_bearer_token_mock .assert_called_once_with ()
146+ ray_get_job_submission_client_cluster_info_mock .assert_called_once_with (
147+ address = tc .ClusterConstants .TEST_VERTEX_RAY_DASHBOARD_ADDRESS ,
148+ _use_tls = True ,
149+ headers = tc .ClusterConstants .TEST_HEADERS ,
150+ )
0 commit comments