Skip to content

Commit

Permalink
Remove redundant test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-matter committed Apr 23, 2024
1 parent 27e7005 commit b63fb59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
8 changes: 3 additions & 5 deletions matter_observability/fastapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ def configure_middleware(app: FastAPI, skip_paths: list[str] | None = None) -> N

app.middleware("http")(process_request_id)

Instrumentator(
excluded_handlers=skip_paths,
should_respect_env_var=True,
env_var_name="ENABLE_METRICS"
).instrument(app=app).expose(app=app, endpoint=metrics_path)
Instrumentator(excluded_handlers=skip_paths, should_respect_env_var=True, env_var_name="ENABLE_METRICS").instrument(
app=app
).expose(app=app, endpoint=metrics_path)
9 changes: 0 additions & 9 deletions tests/fastapi/test_configure_middleware.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
from unittest.mock import Mock

import pytest
from fastapi import FastAPI
from pytest_mock import MockerFixture
from prometheus_fastapi_instrumentator import Instrumentator

from matter_observability.exceptions import MisConfigurationError
from matter_observability.fastapi import configure_middleware


def test_configure_middleware_throws_exception_if_enable_metrics_is_not_set(mocker: MockerFixture):
mocker.patch("matter_observability.config.Config.INSTANCE_NAME", None)
with pytest.raises(MisConfigurationError):
configure_middleware(FastAPI())


def test_configure_middlewares_does_not_add_prometheus_middleware_if_enable_metrics_is_not_set(mocker: MockerFixture):
mocker.patch("matter_observability.config.Config.ENABLE_METRICS", False)

Expand Down

0 comments on commit b63fb59

Please sign in to comment.