This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e315900396 specifying project id when calling wait_for_operation in
delete/create cluster (#26418)
e315900396 is described below
commit e31590039634ff722ad005fe9f1fc02e5a669699
Author: Baiyue Cao <[email protected]>
AuthorDate: Tue Sep 20 03:46:16 2022 -0400
specifying project id when calling wait_for_operation in delete/create
cluster (#26418)
* specifying project id when calling wait_for_operation in delete/create
cluster
---
airflow/providers/google/cloud/hooks/kubernetes_engine.py | 4 ++--
tests/providers/google/cloud/hooks/test_kubernetes_engine.py | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/airflow/providers/google/cloud/hooks/kubernetes_engine.py
b/airflow/providers/google/cloud/hooks/kubernetes_engine.py
index 4cd766e881..57a36af541 100644
--- a/airflow/providers/google/cloud/hooks/kubernetes_engine.py
+++ b/airflow/providers/google/cloud/hooks/kubernetes_engine.py
@@ -180,7 +180,7 @@ class GKEHook(GoogleBaseHook):
retry=retry,
timeout=timeout,
)
- resource = self.wait_for_operation(resource)
+ resource = self.wait_for_operation(resource, project_id)
# Returns server-defined url for the resource
return resource.self_link
except NotFound as error:
@@ -234,7 +234,7 @@ class GKEHook(GoogleBaseHook):
retry=retry,
timeout=timeout,
)
- resource = self.wait_for_operation(resource)
+ resource = self.wait_for_operation(resource, project_id)
return resource.target_link
except AlreadyExists as error:
diff --git a/tests/providers/google/cloud/hooks/test_kubernetes_engine.py
b/tests/providers/google/cloud/hooks/test_kubernetes_engine.py
index 0a542836ee..4bd3598e17 100644
--- a/tests/providers/google/cloud/hooks/test_kubernetes_engine.py
+++ b/tests/providers/google/cloud/hooks/test_kubernetes_engine.py
@@ -73,7 +73,7 @@ class TestGKEHookDelete(unittest.TestCase):
retry=retry_mock,
timeout=timeout_mock,
)
- wait_mock.assert_called_once_with(client_delete.return_value)
+ wait_mock.assert_called_once_with(client_delete.return_value,
TEST_GCP_PROJECT_ID)
@mock.patch(GKE_STRING.format("GKEHook.log"))
@mock.patch(GKE_STRING.format("GKEHook.wait_for_operation"))
@@ -130,7 +130,7 @@ class TestGKEHookCreate(unittest.TestCase):
retry=retry_mock,
timeout=timeout_mock,
)
- wait_mock.assert_called_once_with(client_create.return_value)
+ wait_mock.assert_called_once_with(client_create.return_value,
TEST_GCP_PROJECT_ID)
@mock.patch(GKE_STRING.format("Cluster.from_json"))
@mock.patch(GKE_STRING.format("GKEHook.wait_for_operation"))
@@ -151,7 +151,7 @@ class TestGKEHookCreate(unittest.TestCase):
retry=retry_mock,
timeout=timeout_mock,
)
- wait_mock.assert_called_once_with(client_create.return_value)
+ wait_mock.assert_called_once_with(client_create.return_value,
TEST_GCP_PROJECT_ID)
@mock.patch(GKE_STRING.format("GKEHook.wait_for_operation"))
def test_create_cluster_error(self, wait_mock):