From b22af18a34babc75594bdc0b532c4ca897d4ffae Mon Sep 17 00:00:00 2001 From: Ash Berlin-Taylor Date: Wed, 18 Dec 2024 22:36:21 +0000 Subject: [PATCH] Remove some tests about "roundtripping" a simple TI -- they don't make sense any more --- tests/callbacks/test_callback_requests.py | 39 +---------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/tests/callbacks/test_callback_requests.py b/tests/callbacks/test_callback_requests.py index c5a697f9467da..ce32651deead9 100644 --- a/tests/callbacks/test_callback_requests.py +++ b/tests/callbacks/test_callback_requests.py @@ -16,7 +16,7 @@ # under the License. from __future__ import annotations -from datetime import datetime, timedelta +from datetime import datetime import pytest @@ -30,7 +30,6 @@ from airflow.providers.standard.operators.bash import BashOperator from airflow.utils import timezone from airflow.utils.state import State -from airflow.utils.types import DagRunType pytestmark = pytest.mark.db_test @@ -92,39 +91,3 @@ def test_taskcallback_to_json_with_start_date_and_end_date(self, session, create json_str = input.to_json() result = TaskCallbackRequest.from_json(json_str) assert input == result - - def test_simple_ti_roundtrip_exec_config_pod(self): - """A callback request including a TI with an exec config with a V1Pod should safely roundtrip.""" - from kubernetes.client import models as k8s - - from airflow.callbacks.callback_requests import TaskCallbackRequest - from airflow.models import TaskInstance - from airflow.providers.standard.operators.bash import BashOperator - - test_pod = k8s.V1Pod(metadata=k8s.V1ObjectMeta(name="hello", namespace="ns")) - op = BashOperator(task_id="hi", executor_config={"pod_override": test_pod}, bash_command="hi") - ti = TaskInstance(task=op, run_id="run1") - data = TaskCallbackRequest(full_filepath="hi", ti=ti).to_json() - actual = TaskCallbackRequest.from_json(data).ti.executor_config["pod_override"] - assert actual == test_pod - - def test_simple_ti_roundtrip_dates(self, dag_maker): - """A callback request including a TI with an exec config with a V1Pod should safely roundtrip.""" - from airflow.callbacks.callback_requests import TaskCallbackRequest - from airflow.models import TaskInstance - from airflow.providers.standard.operators.bash import BashOperator - - with dag_maker(schedule=timedelta(weeks=1), serialized=True): - op = BashOperator(task_id="hi", bash_command="hi") - dr = dag_maker.create_dagrun( - run_type=DagRunType.SCHEDULED, - external_trigger=True, - ) - ti = TaskInstance(task=op, run_id=dr.run_id) - ti.refresh_from_db() - ti.set_state("SUCCESS") - start_date = ti.start_date - end_date = ti.end_date - data = TaskCallbackRequest(full_filepath="hi", ti=ti).to_json() - assert TaskCallbackRequest.from_json(data).ti.start_date == start_date - assert TaskCallbackRequest.from_json(data).ti.end_date == end_date