Skip to content

Commit

Permalink
number of tests reduced & fix confluent mark
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-frolov committed Sep 24, 2024
1 parent 8e1b9a2 commit e3262b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions tests/prometheus/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from faststream.broker.core.usecase import BrokerUsecase
from faststream.broker.message import AckStatus, StreamMessage
from faststream.exceptions import RejectMessage
from faststream.prometheus.middleware import (
PROCESSING_STATUS_BY_ACK_STATUS,
PROCESSING_STATUS_BY_HANDLER_EXCEPTION_MAP,
Expand All @@ -32,10 +33,16 @@ def settings_provider_factory(self):
registry=CollectorRegistry()
)._settings_provider_factory

@pytest.mark.parametrize("status", AckStatus)
@pytest.mark.parametrize(
"exception_class",
[*list(PROCESSING_STATUS_BY_HANDLER_EXCEPTION_MAP.keys()), Exception, None],
(
"status",
"exception_class",
),
[
(AckStatus.acked, RejectMessage),
(AckStatus.acked, Exception),
*[(status, None) for status in AckStatus],
],
)
async def test_metrics(
self,
Expand Down
6 changes: 3 additions & 3 deletions tests/prometheus/confluent/test_confluent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tests.prometheus.basic import LocalPrometheusTestcase


@pytest.mark.kafka
@pytest.mark.confluent
class TestPrometheus(LocalPrometheusTestcase):
broker_class = KafkaBroker
middleware_class = KafkaPrometheusMiddleware
Expand Down Expand Up @@ -57,7 +57,7 @@ async def handler(m: message_class):
self.assert_publish_metrics(metrics=metrics_mock)


@pytest.mark.kafka
@pytest.mark.confluent
class TestPublishWithPrometheus(TestPublish):
def get_broker(self, apply_types: bool = False):
return KafkaBroker(
Expand All @@ -66,7 +66,7 @@ def get_broker(self, apply_types: bool = False):
)


@pytest.mark.kafka
@pytest.mark.confluent
class TestConsumeWithTelemetry(TestConsume):
def get_broker(self, apply_types: bool = False):
return KafkaBroker(
Expand Down

0 comments on commit e3262b1

Please sign in to comment.