Skip to content

Commit cf2bac6

Browse files
Key the executor-events transaction test by TaskInstanceUuid
After the attempt-UUID executor event rework, the event buffer is keyed by TaskInstanceUuid rather than the legacy TaskInstanceKey. Keying this regression test's event by ti1.key meant the event never matched a captured task identity and was discarded before reaching set_state, so the test passed even without the session fix it exists to guard. Key it the same way the other tests in this file do, and assert the state actually flips to FAILED before the rollback so a regression is caught again.
1 parent 5a6622f commit cf2bac6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎airflow-core/tests/unit/jobs/test_scheduler_job.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,9 +850,11 @@ def test_process_executor_events_sets_state_in_callers_transaction(self, dag_mak
850850
job_runner = SchedulerJobRunner(Job(), executors=[executor])
851851
job_runner.scheduler_dag_bag = mock.MagicMock()
852852
job_runner.scheduler_dag_bag.get_dag_for_run.side_effect = Exception("failed")
853-
executor.event_buffer[ti1.key] = State.FAILED, None
853+
executor.event_buffer[TaskInstanceUuid(ti1.id)] = State.FAILED, None
854854

855855
job_runner._process_executor_events(executor=executor, session=session)
856+
ti1.refresh_from_db(session=session)
857+
assert ti1.state == TaskInstanceState.FAILED
856858
session.rollback()
857859

858860
ti1.refresh_from_db(session=session)

0 commit comments

Comments
 (0)