You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/30 20:51:31 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #15617: Improve Test Coverage for Kubernetes Executor

kaxil commented on a change in pull request #15617:
URL: https://github.com/apache/airflow/pull/15617#discussion_r624193915



##########
File path: tests/executors/test_kubernetes_executor.py
##########
@@ -120,6 +119,71 @@ def test_execution_date_serialize_deserialize(self):
 
         assert datetime_obj == new_datetime_obj
 
+    @unittest.skipIf(AirflowKubernetesScheduler is None, 'kubernetes python package is not installed')
+    @mock.patch('airflow.executors.kubernetes_executor.get_kube_client')
+    @mock.patch('airflow.executors.kubernetes_executor.client')
+    @mock.patch('airflow.executors.kubernetes_executor.KubernetesJobWatcher')
+    def test_delete_pod_successfully(
+        self, mock_watcher, mock_client, mock_kube_client
+    ):  # pylint: disable=unused-argument
+        pod_id = "my-pod-1"
+        namespace = "my-namespace"
+
+        kube_client = mock.MagicMock()
+        mock_kube_client.return_value.delete_namespaced_pod = kube_client

Review comment:
       This feels weird, why would `mock_kube_client.return_value.delete_namespaced_pod` be equal to `kube_client` ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org