Skip to content

Commit

Permalink
Moving test that updates TI state to right class (#45173)
Browse files Browse the repository at this point in the history
  • Loading branch information
amoghrajesh authored Dec 23, 2024
1 parent 2947b9b commit 567a223
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions tests/api_fastapi/execution_api/routes/test_task_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,33 @@ def test_ti_update_state_to_reschedule(self, client, session, create_task_instan
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):
Expand Down Expand Up @@ -509,33 +536,6 @@ def test_ti_heartbeat_update(self, client, session, create_task_instance, time_m
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):
Expand Down

0 comments on commit 567a223

Please sign in to comment.