You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "keith991001 (via GitHub)" <gi...@apache.org> on 2026/09/10 02:17:16 UTC

[PR] Add missing unit tests for the Celery default configuration builder [airflow]

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

   Adds the missing test module for `airflow.providers.celery.executors.default_celery` and removes its entry from `OVERLOOKED_TESTS` in `test_project_structure.py`, per the checklist in the meta issue.
   
   Scope note: `test_celery_executor.py` already covers the module-reload paths for dict options / engine options / `task_acks_late` / the non-recommended-backend warning, so this module focuses on the uncovered surface with direct calls to the builders:
   
   - `_broker_supports_visibility_timeout` across the broker URL matrix.
   - `_broker_transport_options`: the implicit 24h `visibility_timeout` default (added for redis/sqs/sentinel, absent for amqp, user value respected) and the dict-option error paths (invalid JSON, non-dict JSON).
   - `get_default_celery_config`: defaults, explicit `result_backend` precedence, the `sql_alchemy_conn` fallback (including the driverless-PostgreSQL scheme rewrite and the non-Postgres passthrough), `extra_celery_config` merge/override, result-backend `sentinel_kwargs` parsing and its error path, and the no-`getsection` fallback to the global conf.
   - The SSL branch matrix: inactive default, redis vs amqp key naming, one-way TLS omitting client certs, mutual-TLS-without-certs and unsupported-broker errors.
   
   27 tests, all passing locally via `uv run --project providers/celery pytest ...`; the `test_providers_modules_should_have_tests` guard passes with the entry removed.
   
   related: #35442
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5)
   
   Generated-by: Claude Code (Fable 5) 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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add missing unit tests for the Celery default configuration builder [airflow]

Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on PR #72857:
URL: https://github.com/apache/airflow/pull/72857#issuecomment-5687266873

   Thanks for adding coverage for this module. Could you please:
   
   - Rebase onto current `main` to resolve the conflict in `test_project_structure.py`.
   - Avoid duplicating coverage already present in `test_celery_executor.py`, including visibility timeouts, result-backend parsing/fallbacks, extra configuration, and SSL handling. Please move the relevant existing tests into `test_default_celery.py` and retain the genuinely new cases.
   
   This keeps each behavior covered in one place and avoids maintaining parallel test suites.
   
   ---
   Drafted-by: Codex (GPT-5); reviewed by @dheerajturaga before posting


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Consolidate Celery default configuration tests [airflow]

Posted by "keith991001 (via GitHub) via commits" <co...@airflow.apache.org>.
keith991001 commented on code in PR #72857:
URL: https://github.com/apache/airflow/pull/72857#discussion_r4715943259


##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -131,6 +144,7 @@ def test_result_backend_preserves_explicit_prepare_threshold(prepare_threshold):
             assert connect_kwargs["connect_timeout"] == 7
 
 
+@requires_psycopg3

Review Comment:
   Agreed. The SQLite case only uses the pysqlite driver, so I removed its Psycopg 3 guard in 3c62e041bc.
   
   ---
   Drafted-by: Codex (GPT-6)



##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########


Review Comment:
   Good catch. In 3c62e041bc the skip marker is on the three parameters that expect the Psycopg 3 driver. The explicit Psycopg 2 parameter still runs without Psycopg 3, with both engine option variants.
   
   ---
   Drafted-by: Codex (GPT-6)



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add missing unit tests for the Celery default configuration builder [airflow]

Posted by "keith991001 (via GitHub)" <gi...@apache.org>.
keith991001 commented on PR #72857:
URL: https://github.com/apache/airflow/pull/72857#issuecomment-5690758613

   Thanks for the review! Both points are addressed:
   
   - Rebased onto current `main`; the `test_project_structure.py` conflict is resolved.
   - Consolidated the coverage in b433689: the `default_celery` tests that had accumulated in `test_celery_executor.py` (visibility-timeout warnings, result-backend warning and engine options, broker-transport dict options, `task_acks_late`, and the SSL matrix including the amqps cases) now live in `test_default_celery.py` in the direct `get_default_celery_config` style, deduplicated against the new cases — net −448/+122 lines. Both files pass locally (40 + 32 tests), along with mypy and the project-structure guard.
   
   ---
   Drafted-by: Claude Code (Fable 5); reviewed by @keith991001 before posting
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add missing unit tests for the Celery default configuration builder [airflow]

Posted by "keith991001 (via GitHub)" <gi...@apache.org>.
keith991001 commented on PR #72857:
URL: https://github.com/apache/airflow/pull/72857#issuecomment-5762165309

   Human review note from @keith991001: the requested changes are addressed and CI is green.
   
   > @dheerajturaga, gentle ping when you have capacity. The requested rebase and test deduplication are complete. Thank you!
   
   ---
   Drafted-by: Codex (GPT-5); reviewed by @keith991001 before posting
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add missing unit tests for the Celery default configuration builder [airflow]

Posted by "keith991001 (via GitHub) via commits" <co...@airflow.apache.org>.
keith991001 commented on PR #72857:
URL: https://github.com/apache/airflow/pull/72857#issuecomment-6758352585

   Rebased onto current main and resolved both test-file conflicts. The upstream Psycopg backend tests are preserved; their skip condition is scoped to those cases so it does not skip the added configuration tests. Existing configuration coverage is consolidated in test_default_celery.py, including all 11 original broker dictionary-option cases. Ruff checks pass locally; provider runtime and full repository checks still need GitHub CI because the local Windows environment lacks Breeze/Docker support.
   
   The current upstream CI runs are awaiting maintainer approval.
   
   ---
   Drafted-by: Codex (GPT-6); reviewed by @keith991001 before posting


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Consolidate Celery default configuration tests [airflow]

Posted by "Miretpl (via GitHub) via commits" <co...@airflow.apache.org>.
Miretpl commented on code in PR #72857:
URL: https://github.com/apache/airflow/pull/72857#discussion_r4578105868


##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -157,6 +171,7 @@ def test_result_backend_does_not_add_psycopg_options_to_sqlite():
         ("celery", "result_backend_sqlalchemy_engine_options"): '{"pool_recycle": 1800}',
     }
 )
+@requires_psycopg3

Review Comment:
   Does this really require psycopg3?



##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -169,7 +184,462 @@ def test_non_database_result_backend_keeps_engine_options():
         ("celery", "result_backend_sqlalchemy_engine_options"): '{"pool_recycle": 1800}',
     }
 )
+@requires_psycopg3

Review Comment:
   Does this really require psycopg3?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Consolidate Celery default configuration tests [airflow]

Posted by "keith991001 (via GitHub) via commits" <co...@airflow.apache.org>.
keith991001 commented on code in PR #72857:
URL: https://github.com/apache/airflow/pull/72857#discussion_r4623957090


##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -157,6 +171,7 @@ def test_result_backend_does_not_add_psycopg_options_to_sqlite():
         ("celery", "result_backend_sqlalchemy_engine_options"): '{"pool_recycle": 1800}',
     }
 )
+@requires_psycopg3

Review Comment:
   No. The Redis backend returns the engine options before SQLAlchemy looks up a dialect, so this case does not need Psycopg 3. I removed the skip marker in 55757321c7. Thanks for catching this!
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add missing unit tests for the Celery default configuration builder [airflow]

Posted by "Miretpl (via GitHub) via commits" <co...@airflow.apache.org>.
Miretpl commented on PR #72857:
URL: https://github.com/apache/airflow/pull/72857#issuecomment-6611492580

   Hi @keith991001, could you rebase and resolve the conflicts?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Consolidate Celery default configuration tests [airflow]

Posted by "keith991001 (via GitHub) via commits" <co...@airflow.apache.org>.
keith991001 commented on code in PR #72857:
URL: https://github.com/apache/airflow/pull/72857#discussion_r4623957331


##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -169,7 +184,462 @@ def test_non_database_result_backend_keeps_engine_options():
         ("celery", "result_backend_sqlalchemy_engine_options"): '{"pool_recycle": 1800}',
     }
 )
+@requires_psycopg3

Review Comment:
   No. The unknown dialect raises `NoSuchModuleError` during SQLAlchemy dialect lookup, and the configuration builder returns the original engine options without loading Psycopg. I removed this skip marker too in 55757321c7.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Consolidate Celery default configuration tests [airflow]

Posted by "Miretpl (via GitHub) via commits" <co...@airflow.apache.org>.
Miretpl commented on code in PR #72857:
URL: https://github.com/apache/airflow/pull/72857#discussion_r4634128258


##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -131,6 +144,7 @@ def test_result_backend_preserves_explicit_prepare_threshold(prepare_threshold):
             assert connect_kwargs["connect_timeout"] == 7
 
 
+@requires_psycopg3

Review Comment:
   This one is probably also not needed.



##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########


Review Comment:
   We are testing here also version 2 and adding `@requires_psycopg3` will basically skip that test case.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Consolidate Celery default configuration tests [airflow]

Posted by "keith991001 (via GitHub) via commits" <co...@airflow.apache.org>.
keith991001 commented on code in PR #72857:
URL: https://github.com/apache/airflow/pull/72857#discussion_r4623957090


##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -157,6 +171,7 @@ def test_result_backend_does_not_add_psycopg_options_to_sqlite():
         ("celery", "result_backend_sqlalchemy_engine_options"): '{"pool_recycle": 1800}',
     }
 )
+@requires_psycopg3

Review Comment:
   No. The Redis backend returns the engine options before SQLAlchemy looks up a dialect, so this case does not need Psycopg 3. I removed the skip marker in 55757321c7. Thanks for catching this!
   
   ---
   Drafted-by: Codex (GPT-6)



##########
providers/celery/tests/unit/celery/executors/test_default_celery.py:
##########
@@ -169,7 +184,462 @@ def test_non_database_result_backend_keeps_engine_options():
         ("celery", "result_backend_sqlalchemy_engine_options"): '{"pool_recycle": 1800}',
     }
 )
+@requires_psycopg3

Review Comment:
   No. The unknown dialect raises `NoSuchModuleError` during SQLAlchemy dialect lookup, and the configuration builder returns the original engine options without loading Psycopg. I removed this skip marker too in 55757321c7.
   
   ---
   Drafted-by: Codex (GPT-6)



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org