From 30a121fd073c01d71cc32d055a55acbf696206c1 Mon Sep 17 00:00:00 2001 From: "jake@prefect.io" Date: Sun, 21 Apr 2024 10:49:08 -0400 Subject: [PATCH] fix cloud run worker v2 vpc access --- prefect_gcp/workers/cloud_run_v2.py | 2 +- tests/test_cloud_run_worker_v2.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/prefect_gcp/workers/cloud_run_v2.py b/prefect_gcp/workers/cloud_run_v2.py index e796e33..eb97afa 100644 --- a/prefect_gcp/workers/cloud_run_v2.py +++ b/prefect_gcp/workers/cloud_run_v2.py @@ -247,7 +247,7 @@ def _remove_vpc_access_if_unset(self): # if connector is the only key and it's not set, we'll remove it. # otherwise we'll pass whatever the user has provided. if len(vpc_access) == 1 and vpc_access.get("connector") is None: - self.job_body["template"]["template"]["vpcAccess"] = None + self.job_body["template"]["template"].pop("vpcAccess") # noinspection PyMethodParameters @validator("job_body") diff --git a/tests/test_cloud_run_worker_v2.py b/tests/test_cloud_run_worker_v2.py index 1b90281..ab3309c 100644 --- a/tests/test_cloud_run_worker_v2.py +++ b/tests/test_cloud_run_worker_v2.py @@ -132,8 +132,8 @@ def test_remove_vpc_access_if_unset(self, cloud_run_worker_v2_job_config): cloud_run_worker_v2_job_config._remove_vpc_access_if_unset() assert ( - cloud_run_worker_v2_job_config.job_body["template"]["template"]["vpcAccess"] - is None + "vpcAccess" + not in cloud_run_worker_v2_job_config.job_body["template"]["template"] ) def test_vpc_access_left_alone_if_connector_set(