Andrushika commented on code in PR #74571:
URL: https://github.com/apache/airflow/pull/74571#discussion_r4245109094
##########
task-sdk/tests/task_sdk/execution_time/test_task_runner.py:
##########
@@ -283,7 +285,116 @@ def test_parse(test_dags_dir: Path, make_ti_context,
coordinates, map_index):
assert ti.map_index == map_index
[email protected](
+ ("policy_timeout", "expected_sends"),
+ [
+ pytest.param(
+ 12.5,
+ [
+ mock.call(SetTimeout(timeout_seconds=12.5)),
+ mock.call(SetTimeout(timeout_seconds=0)),
+ ],
+ id="armed_then_cleared",
+ ),
+ pytest.param(0, [], id="policy_disables_timeout"),
+ ],
+)
[email protected]("airflow.sdk.execution_time.task_runner.get_dagbag_import_timeout",
autospec=True)
+def test_parse_arms_supervisor_import_timeout(
+ mock_get_timeout,
+ test_dags_dir: Path,
+ make_ti_context,
+ mock_supervisor_comms,
+ policy_timeout,
+ expected_sends,
+):
+ mock_get_timeout.return_value = policy_timeout
+
+ what = StartupDetails(
+ ti=TaskInstance(
+ id=uuid7(),
+ task_id="a",
+ dag_id="super_basic",
+ run_id="c",
+ try_number=1,
+ dag_version_id=uuid7(),
+ queue="default",
+ ),
+ dag_rel_path="super_basic.py",
+ bundle_info=BundleInfo(name="my-bundle", version=None),
+ ti_context=make_ti_context(),
+ start_date=timezone.utcnow(),
+ sentry_integration="",
+ )
Review Comment:
I kinda want to turn the `StartupDetails` setup into a common fixture, since
about 20 tests in this file build it inline.
That would be a separate follow-up though, happy to do it if maintainers
think it's worth it
--
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]