|
8 | 8 | import pytest |
9 | 9 | from aiohttp import web |
10 | 10 | from models_library.utils.json_serialization import json_dumps |
11 | | -from opentelemetry.instrumentation.aiohttp_server import ( |
12 | | - middleware as aiohttp_opentelemetry_middleware, |
13 | | -) |
14 | 11 | from pydantic import HttpUrl, parse_obj_as |
15 | 12 | from pytest_simcore.helpers.monkeypatch_envs import ( |
16 | 13 | setenvs_from_dict, |
17 | 14 | setenvs_from_envfile, |
18 | 15 | ) |
19 | 16 | from pytest_simcore.helpers.typing_env import EnvVarsDict |
20 | | -from simcore_service_webserver.application import create_application |
21 | 17 | from simcore_service_webserver.application_settings import ( |
22 | 18 | APP_SETTINGS_KEY, |
23 | 19 | ApplicationSettings, |
@@ -255,38 +251,3 @@ def test_avoid_sensitive_info_in_public(app_settings: ApplicationSettings): |
255 | 251 | assert not any("token" in key for key in app_settings.public_dict()) |
256 | 252 | assert not any("secret" in key for key in app_settings.public_dict()) |
257 | 253 | assert not any("private" in key for key in app_settings.public_dict()) |
258 | | - |
259 | | - |
260 | | -@pytest.fixture |
261 | | -def tracing_settings_in(request): |
262 | | - return request.param |
263 | | - |
264 | | - |
265 | | -@pytest.mark.parametrize( |
266 | | - "tracing_settings_in", |
267 | | - [ |
268 | | - ("http://opentelemetry-collector", 4318), |
269 | | - ], |
270 | | - indirect=True, |
271 | | -) |
272 | | -async def test_middleware_restirctions_opentelemetry_is_second_middleware( |
273 | | - mock_webserver_service_environment: EnvVarsDict, |
274 | | - monkeypatch: pytest.MonkeyPatch, |
275 | | - tracing_settings_in, |
276 | | -): |
277 | | - monkeypatch.setenv( |
278 | | - "TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT", f"{tracing_settings_in[0]}" |
279 | | - ) |
280 | | - monkeypatch.setenv( |
281 | | - "TRACING_OPENTELEMETRY_COLLECTOR_PORT", f"{tracing_settings_in[1]}" |
282 | | - ) |
283 | | - settings = ApplicationSettings.create_from_envs() |
284 | | - assert settings.WEBSERVER_TRACING |
285 | | - app = create_application() |
286 | | - assert app.middlewares |
287 | | - assert ( |
288 | | - app.middlewares[0].__middleware_name__ |
289 | | - == "servicelib.aiohttp.monitoring.monitor_simcore_service_webserver" |
290 | | - ) |
291 | | - assert app.middlewares[1] == aiohttp_opentelemetry_middleware |
292 | | - assert len(app.middlewares) > 1 |
0 commit comments