This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 567a22355ac Moving test that updates TI state to right class (#45173)
567a22355ac is described below
commit 567a22355ac308ea64cd3804db09d9b0dcb286b3
Author: Amogh Desai <[email protected]>
AuthorDate: Mon Dec 23 18:07:06 2024 +0530
Moving test that updates TI state to right class (#45173)
---
.../execution_api/routes/test_task_instances.py | 54 +++++++++++-----------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/tests/api_fastapi/execution_api/routes/test_task_instances.py
b/tests/api_fastapi/execution_api/routes/test_task_instances.py
index 4ed5f8f1598..b997a2e0ac8 100644
--- a/tests/api_fastapi/execution_api/routes/test_task_instances.py
+++ b/tests/api_fastapi/execution_api/routes/test_task_instances.py
@@ -340,6 +340,33 @@ class TestTIUpdateState:
assert trs[0].map_index == -1
assert trs[0].duration == 129600
+ def test_ti_update_state_to_failed_table_check(self, client, session,
create_task_instance):
+ ti = create_task_instance(
+ task_id="test_ti_update_state_to_failed_table_check",
+ state=State.RUNNING,
+ )
+ ti.start_date = DEFAULT_START_DATE
+ session.commit()
+
+ response = client.patch(
+ f"/execution/task-instances/{ti.id}/state",
+ json={
+ "state": State.FAILED,
+ "end_date": DEFAULT_END_DATE.isoformat(),
+ },
+ )
+
+ assert response.status_code == 204
+ assert response.text == ""
+
+ session.expire_all()
+
+ ti = session.get(TaskInstance, ti.id)
+ assert ti.state == State.FAILED
+ assert ti.next_method is None
+ assert ti.next_kwargs is None
+ assert ti.duration == 3600.00
+
class TestTIHealthEndpoint:
def setup_method(self):
@@ -509,33 +536,6 @@ class TestTIHealthEndpoint:
session.refresh(ti)
assert ti.last_heartbeat_at == time_now.add(minutes=10)
- def test_ti_update_state_to_failed_table_check(self, client, session,
create_task_instance):
- ti = create_task_instance(
- task_id="test_ti_update_state_to_failed_table_check",
- state=State.RUNNING,
- )
- ti.start_date = DEFAULT_START_DATE
- session.commit()
-
- response = client.patch(
- f"/execution/task-instances/{ti.id}/state",
- json={
- "state": State.FAILED,
- "end_date": DEFAULT_END_DATE.isoformat(),
- },
- )
-
- assert response.status_code == 204
- assert response.text == ""
-
- session.expire_all()
-
- ti = session.get(TaskInstance, ti.id)
- assert ti.state == State.FAILED
- assert ti.next_method is None
- assert ti.next_kwargs is None
- assert ti.duration == 3600.00
-
class TestTIPutRTIF:
def setup_method(self):