uranusjr commented on code in PR #59097:
URL: https://github.com/apache/airflow/pull/59097#discussion_r2674307959
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py:
##########
@@ -2199,6 +2199,83 @@ def
test_process_duplicate_label_pods__label_patched_if_action_is_not_delete_pod
process_pod_deletion_mock.assert_not_called()
assert result.metadata.name == pod_2.metadata.name
+ @pytest.mark.parametrize(
+ "on_finish_action", [OnFinishAction.KEEP_POD,
OnFinishAction.DELETE_SUCCEEDED_POD]
+ )
+ @patch(KUB_OP_PATH.format("patch_already_checked"))
+ @patch(KUB_OP_PATH.format("process_pod_deletion"))
+ def test_process_duplicate_label_pods_with_start_time_none(
+ self,
+ process_pod_deletion_mock,
+ patch_already_checked_mock,
+ on_finish_action,
+ ):
+ now = datetime.datetime.now()
+ k = KubernetesPodOperator(
+ namespace="default",
+ image="ubuntu:22.04",
+ cmds=["bash", "-cx"],
+ arguments=["echo 12"],
+ name="test",
+ task_id="task",
+ do_xcom_push=False,
+ reattach_on_restart=False,
+ on_finish_action=on_finish_action,
+ )
+ context = create_context(k)
+ pod_1 =
k.get_or_create_pod(pod_request_obj=k.build_pod_request_obj(context),
context=context)
+ pod_2 =
k.get_or_create_pod(pod_request_obj=k.build_pod_request_obj(context),
context=context)
+
+ pod_1.status = {"start_time": None}
+ pod_2.status = {"start_time": None}
Review Comment:
I’d argue other tests should use this pattern too.
--
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]