Skip to content

Commit 850d6be

Browse files
committed
Test for both env vars
1 parent c1eb722 commit 850d6be

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -805,20 +805,25 @@ async def do_request(url):
805805
)
806806
self.memory_exporter.clear()
807807

808-
@mock.patch.dict(
809-
os.environ, {"OTEL_PYTHON_AIOHTTP_CLIENT_EXCLUDED_URLS": "/some/path"}
810-
)
811808
def test_ignores_excluded_urls(self):
812809
async def request_handler(request):
813810
assert "traceparent" not in request.headers
814811
return aiohttp.web.Response(status=HTTPStatus.OK)
815812

816-
self._http_request(
817-
trace_config=aiohttp_client.create_trace_config(),
818-
request_handler=request_handler,
819-
url="/some/path?query=param&other=param2",
820-
status_code=HTTPStatus.OK,
821-
)
813+
for env_var in (
814+
"OTEL_PYTHON_AIOHTTP_CLIENT_EXCLUDED_URLS",
815+
"OTEL_PYTHON_EXCLUDED_URLS",
816+
):
817+
with self.subTest(env_var=env_var):
818+
with mock.patch.dict(
819+
os.environ, {env_var: "/some/path"}, clear=True
820+
):
821+
self._http_request(
822+
trace_config=aiohttp_client.create_trace_config(),
823+
request_handler=request_handler,
824+
url="/some/path?query=param&other=param2",
825+
status_code=HTTPStatus.OK,
826+
)
822827

823828
self._assert_spans([], 0)
824829
self._assert_metrics(0)

0 commit comments

Comments
 (0)