This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-3-test by this push:
new 9235e5c91af [v3-3-test] Fix getsection() dropping env-var overrides on
lazy-registered provider sections (#68895) (#70732)
9235e5c91af is described below
commit 9235e5c91af90fc0b8b5a86bb0be2bd0d5d942e7
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Jul 30 11:23:17 2026 +0200
[v3-3-test] Fix getsection() dropping env-var overrides on lazy-registered
provider sections (#68895) (#70732)
(cherry picked from commit d11422ee0c6aa95f73af90f9296e543a7727e4a4)
Co-authored-by: Software Developer
<[email protected]>
---
airflow-core/tests/unit/core/test_configuration.py | 30 ++++++++++++++++++++++
.../src/airflow_shared/configuration/parser.py | 2 +-
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/airflow-core/tests/unit/core/test_configuration.py
b/airflow-core/tests/unit/core/test_configuration.py
index abc42c26433..a2b591d0784 100644
--- a/airflow-core/tests/unit/core/test_configuration.py
+++ b/airflow-core/tests/unit/core/test_configuration.py
@@ -2060,6 +2060,36 @@ class TestProviderConfigPriority:
with conf_vars({("celery", "celery_app_name"): custom_value}):
assert conf.get("celery", "celery_app_name") == custom_value
+ def test_getsection_returns_env_var_only_provider_section(self,
monkeypatch):
+ """Env vars are picked up for a provider section whose keys all
default to None."""
+ from airflow.settings import conf
+
+
monkeypatch.setenv("AIRFLOW__CELERY_BROKER_TRANSPORT_OPTIONS__VISIBILITY_TIMEOUT",
"21600")
+
monkeypatch.setenv("AIRFLOW__CELERY_BROKER_TRANSPORT_OPTIONS__MASTER_NAME",
"mymaster")
+
+ section = conf.getsection("celery_broker_transport_options")
+
+ assert section is not None
+ assert section["visibility_timeout"] == 21600
+ assert section["master_name"] == "mymaster"
+
+ def
test_getsection_returns_env_var_only_provider_section_via_cfg_fallback(self,
monkeypatch):
+ """Env vars are picked up for a section that lives only in provider
cfg fallback defaults."""
+ from airflow.settings import conf
+
+ monkeypatch.setenv("AIRFLOW__ELASTICSEARCH__END_OF_LOG_MARK",
"env_override_mark")
+
+ section = conf.getsection("elasticsearch")
+
+ assert section is not None
+ assert section["end_of_log_mark"] == "env_override_mark"
+
+ def test_getsection_returns_none_for_truly_unknown_section(self):
+ """Sections not declared anywhere and with no env vars still return
None."""
+ from airflow.settings import conf
+
+ assert conf.getsection("section_that_does_not_exist_anywhere") is None
+
# Technically it's not a DB test, but we want to make sure it's not
interfering with xdist non-db tests
# Because the `_cleanup` method might cause side-effect for parallel-run tests
diff --git a/shared/configuration/src/airflow_shared/configuration/parser.py
b/shared/configuration/src/airflow_shared/configuration/parser.py
index 74ca43379dc..2cfb946ad32 100644
--- a/shared/configuration/src/airflow_shared/configuration/parser.py
+++ b/shared/configuration/src/airflow_shared/configuration/parser.py
@@ -1879,7 +1879,7 @@ class AirflowConfigParser(ConfigParser):
# Handle team-specific section lookup for config file
config_section = f"{team_name}={section}" if team_name else section
- if not self.has_section(config_section) and not
self._default_values.has_section(config_section):
+ if not self.has_section(config_section) and not
self._has_section_in_any_defaults(config_section):
return None
if self._default_values.has_section(config_section):
_section: ConfigOptionsDictType =
dict(self._default_values.items(config_section))