shahar1 opened a new pull request, #74122:
URL: https://github.com/apache/airflow/pull/74122

   `test_scheduler_restart_adopts_queued_edge_task` (added in #73832) fails 
when the `cncf.kubernetes` and `edge3` test suites run in the same pytest 
process, which is how CI groups them:
   
   ```
   
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:182:
 in _list_pods
       dynamic_client = DynamicClient(self.kube_client.api_client)
   E   AttributeError: 'NoneType' object has no attribute 'api_client'
   ```
   
   Tests in other providers (`cncf.kubernetes`, `celery`) call 
`importlib.reload()` on `airflow.executors.executor_loader`. That replaces the 
`ExecutorLoader` class object in the module, while the module that builds the 
scheduler's executors keeps the class it imported at startup. The edge3 test 
patched `init_executors` through the module path, so the patch landed on the 
new class, the scheduler resolved executors through the original one, picked up 
the executor-name cache those tests leave populated with `KubernetesExecutor`, 
and called into an unstarted Kubernetes executor.
   
   The test now patches `init_executors` on the class object held by the module 
that actually calls it: `airflow.jobs.job` on Airflow 3.0/3.1 and 
`airflow.jobs.scheduler_job_runner` on 3.2+ (the edge3 compat matrix covers 
3.0.6, 3.1.8, 3.2.2 and 3.3.2).
   
   Test-only change. The shipped `edge_executor.py` fix from #73832 is 
unaffected and works as released. Not fixing the leaking reloads in 
`cncf.kubernetes`/`celery` tests here; replacing those `reload()` calls with 
the `clean_executor_loader` fixture is a separate cleanup.
   
   Verified locally with `breeze testing providers-tests --test-type 
"Providers[cncf.kubernetes,edge3]"`: the test fails on `main` and passes with 
this change.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5.1)
   
   Generated-by: Claude Code (Fable 5.1) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to