amoghrajesh commented on code in PR #75842:
URL: https://github.com/apache/airflow/pull/75842#discussion_r4397645377
##########
shared/observability/tests/observability/metrics/test_otel_logger.py:
##########
@@ -499,7 +499,15 @@ def test_config_priorities(
airflow_conf_port,
expected_endpoint,
expected_exporter_module,
+ monkeypatch,
):
+ # Clear any ambient OTEL_* vars so the case only sees its own
provided_env_vars.
+ # CI runners (e.g. RunsOn) export OTEL_EXPORTER_OTLP_ENDPOINT, which
otherwise wins
+ # over the Airflow config host/port and makes the config-priority
cases fail.
+ for name in list(os.environ):
Review Comment:
Can we instead move the clearing into a class scoped autouse fixture,
something like:
```python
@pytest.fixture(autouse=True)
def _clear_otel_env(self, monkeypatch):
for name in list(os.environ):
if name.startswith("OTEL_"):
monkeypatch.delenv(name, raising=False)
```
Every test in TestOtelMetrics gets benefit, not just one.
--
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]