potiuk commented on code in PR #28776:
URL: https://github.com/apache/airflow/pull/28776#discussion_r1063975139
##########
tests/executors/test_kubernetes_executor.py:
##########
@@ -718,20 +718,42 @@ def test_adopt_launched_task(self, mock_kube_client):
pod_ids = {ti_key: {}}
executor.adopt_launched_task(mock_kube_client, pod=pod,
pod_ids=pod_ids)
- assert mock_kube_client.patch_namespaced_pod.call_args[1] == {
- "body": {
- "metadata": {
- "labels": {"airflow-worker": "modified"},
- "annotations": annotations,
- "name": "foo",
- }
- },
- "name": "foo",
- "namespace": None,
- }
+ mock_kube_client.patch_namespaced_pod.assert_called_once_with(
+ body={"metadata": {"labels": {"airflow-worker": "modified"}}},
+ name="foo",
+ namespace=None,
+ )
assert pod_ids == {}
assert executor.running == {ti_key}
+ @mock.patch("airflow.executors.kubernetes_executor.get_kube_client")
+ def test_adopt_completed_pods(self, mock_kube_client):
Review Comment:
I am rather opting for very long and very descriptive test method names:
`test_adopted_pod_only_update_label_and_nothing_else`
(I am not joking).
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]