nyxrv0id commented on code in PR #75479:
URL: https://github.com/apache/airflow/pull/75479#discussion_r4382385863
##########
providers/google/tests/unit/google/cloud/triggers/test_kubernetes_engine.py:
##########
@@ -163,6 +163,54 @@ def
test_serialize_round_trip_preserves_on_finish_action(self):
assert reconstructed_trigger.on_finish_action.value ==
"delete_succeeded_pod"
+ def test_serialize_emits_log_events_on_startup_only_when_disabled(self,
trigger):
+ assert "log_events_on_startup" not in trigger.serialize()[1]
+
+ trigger.log_events_on_startup = False
+
+ _, kwargs_dict = trigger.serialize()
+
+ assert kwargs_dict["log_events_on_startup"] is False
+ reconstructed = GKEStartPodTrigger(**kwargs_dict)
+ assert reconstructed.log_events_on_startup is False
+
+ @pytest.mark.asyncio
+ @pytest.mark.parametrize(
+ ("log_events_on_startup", "expected_calls"),
+ [(True, 1), (False, 0)],
+ )
+ @mock.patch(f"{TRIGGER_KUB_POD_PATH}.define_pod_container_state",
autospec=True)
+ @mock.patch(
+
"airflow.providers.cncf.kubernetes.triggers.pod.AsyncPodManager.await_pod_start",
autospec=True
+ )
+ @mock.patch(
+
"airflow.providers.cncf.kubernetes.triggers.pod.AsyncPodManager.watch_pod_events",
autospec=True
+ )
+ @mock.patch(f"{TRIGGER_KUB_POD_PATH}._get_pod", autospec=True)
+ async def test_wait_for_pod_start_watches_events_only_when_enabled(
Review Comment:
Good point. Both triggers inherit `_wait_for_pod_start()` from
`KubernetesPodTrigger`, so these tests duplicated coverage already provided by
the CNCF Kubernetes provider's base-trigger tests. I've removed the redundant
tests while retaining the relevant EKS/GKE parameter-forwarding and
serialization coverage.
--
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]