Skip to content

Commit

Permalink
wip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
galbash committed Apr 8, 2024
1 parent f9ee608 commit 81bdcec
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from unittest import TestCase, mock

from pika.adapters import BlockingConnection
from pika.adapters.blocking_connection import _QueueConsumerGeneratorInfo
from pika.channel import Channel
from wrapt import BoundFunctionWrapper

Expand All @@ -40,6 +41,9 @@ def test_instrument_api(self) -> None:
self.assertTrue(
isinstance(BlockingConnection.channel, BoundFunctionWrapper)
)
self.assertTrue(
isinstance(_QueueConsumerGeneratorInfo.__init__, BoundFunctionWrapper)
)
assert hasattr(
instrumentation, "__opentelemetry_tracer_provider"
), "Tracer not stored for the object!"
Expand All @@ -57,15 +61,11 @@ def test_instrument_api(self) -> None:
@mock.patch(
"opentelemetry.instrumentation.pika.PikaInstrumentor._instrument_blocking_channel_consumers"
)
@mock.patch(
"opentelemetry.instrumentation.pika.PikaInstrumentor._decorate_queue_consumer_generator"
)
def test_instrument(
def test_instrument_channel(
self,
instrument_blocking_channel_consumers: mock.MagicMock,
instrument_basic_consume: mock.MagicMock,
instrument_channel_functions: mock.MagicMock,
instrument_queue_consumer_generator: mock.MagicMock,
):
PikaInstrumentor.instrument_channel(channel=self.channel)
assert hasattr(
Expand All @@ -74,7 +74,6 @@ def test_instrument(
instrument_blocking_channel_consumers.assert_called_once()
instrument_basic_consume.assert_called_once()
instrument_channel_functions.assert_called_once()
instrument_queue_consumer_generator.assert_called_once()

@mock.patch("opentelemetry.instrumentation.pika.utils._decorate_callback")
def test_instrument_consumers(
Expand Down

0 comments on commit 81bdcec

Please sign in to comment.