This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-2-test by this push:
new 16a1097fa00 [v3-2-test] Add jobless_supervisor fixture for backported
triggerer-FD test (#66743)
16a1097fa00 is described below
commit 16a1097fa0096237cda1e4c4362dd451d0a0cc68
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue May 12 03:33:22 2026 +0200
[v3-2-test] Add jobless_supervisor fixture for backported triggerer-FD test
(#66743)
v3-2-test is currently red because the test
test_trigger_logger_fd_closed_when_upload_to_remote_raises (backported
via #66684 from #66675) consumes a `jobless_supervisor` fixture that
was never backported to this branch.
Root cause: the fixture was added on main by #66006 ("Make
TriggerRunnerSupervisor.job optional"), which is a feature change and
was correctly skipped from release-branch backports. The subsequent
fix backport (#66684) brought only the test definition, so the test
errored at setup with "fixture 'jobless_supervisor' not found" across
every DB/Python matrix cell.
Cherry-picking #66006 wholesale isn't viable: 4 conflict regions in
triggerer_job_runner.py totalling ~150 lines (v3-2-test has diverged
since 2026-04-30), and it would drag a feature into a release branch.
Instead, add the fixture inline with the same name and shape as main's
but adapted for v3-2-test's still-required `job: Job` constraint —
use mocker.Mock(spec=Job) instead of job=None. The test only
exercises logger_cache, running_triggers, and _handle_request, none
of which touch the .job attribute, so the mock is sufficient.
---
airflow-core/tests/unit/jobs/test_triggerer_job.py | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/airflow-core/tests/unit/jobs/test_triggerer_job.py
b/airflow-core/tests/unit/jobs/test_triggerer_job.py
index a6cd87d3dbd..534067a47e0 100644
--- a/airflow-core/tests/unit/jobs/test_triggerer_job.py
+++ b/airflow-core/tests/unit/jobs/test_triggerer_job.py
@@ -402,6 +402,43 @@ def test_trigger_logger_fd_closed_when_removed(session):
trigger_runner_supervisor.kill(force=False)
[email protected]
+def jobless_supervisor(mocker):
+ """Build a TriggerRunnerSupervisor with a mock Job, for testing
request-handling paths
+ that don't depend on a real DB-backed Job.
+
+ Named ``jobless_supervisor`` for naming parity with main, where the
supervisor's ``job``
+ parameter is genuinely optional (made optional in #66006 — not backported
to v3-2-test).
+ The test that uses this fixture
(``test_trigger_logger_fd_closed_when_upload_to_remote_raises``)
+ only exercises ``logger_cache``, ``running_triggers``, and
``_handle_request``, none of
+ which touch the ``job`` attribute, so a Mock(spec=Job) is sufficient.
+ """
+ import psutil
+
+ job = mocker.Mock(spec=Job)
+ job.id = 42
+ job.hostname = "test-host"
+
+ process = mocker.Mock(spec=psutil.Process, pid=42)
+ mock_stdin = mocker.Mock(spec=socket)
+ mock_stdin.write = mocker.Mock()
+ mock_stdin.sendall = mocker.Mock()
+
+ supervisor = TriggerRunnerSupervisor(
+ process_log=mocker.Mock(spec=FilteringBoundLogger),
+ id=uuid.uuid4(),
+ job=job,
+ pid=process.pid,
+ stdin=mock_stdin,
+ process=process,
+ capacity=10,
+ )
+ mock_selector = mocker.Mock(spec=selectors.DefaultSelector)
+ mock_selector.select.return_value = []
+ supervisor.selector = mock_selector
+ return supervisor
+
+
def
test_trigger_logger_fd_closed_when_upload_to_remote_raises(jobless_supervisor):
"""If upload_to_remote() raises during finished-trigger cleanup, the FD
must still be closed.