XD-DENG commented on a change in pull request #14380:
URL: https://github.com/apache/airflow/pull/14380#discussion_r590700456
##########
File path: tests/core/test_configuration.py
##########
@@ -80,6 +80,15 @@ def test_case_sensitivity(self):
assert conf.get("core", "PERCENT") == "with%inside"
assert conf.get("CORE", "PERCENT") == "with%inside"
+ def test_config_as_dict(self):
+ """Test that getting config as dict works even if
+ environment has non-legal env vars"""
+ with unittest.mock.patch.dict('os.environ'):
+ os.environ['AIRFLOW__VAR__broken'] = "not_ok"
+ asdict = conf.as_dict(raw=True, display_sensitive=True)
+ assert asdict.get('VAR') is None
Review comment:
I think what @ashb wants is actually aligned with what @haard is trying
to do here.
We want to support the user-defined config sections/keys. But if user gives
an env var like `AIRFLOW__S__key`, they expect to have something like
`conf.as_dict().get('S').get('key')` OR `conf.as_dict().get('S').get('KEY')`.
But actually the current behaviour is the whole process crashes.
What @haard does here is to avoid crash + enforce all-uppercase env var
(otherwise ignored). Personally I'm ok with 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.
For queries about this service, please contact Infrastructure at:
[email protected]