Skip to content

Commit bc01feb

Browse files
committed
add callback attr name test
1 parent 68f9783 commit bc01feb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

instrumentation/opentelemetry-instrumentation-pika/tests/test_pika_instrumentation.py

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from wrapt import BoundFunctionWrapper
1919

2020
from opentelemetry.instrumentation.pika import PikaInstrumentor
21+
from opentelemetry.instrumentation.pika.pika_instrumentor import _consumer_callback_attribute_name
2122
from opentelemetry.instrumentation.pika.utils import dummy_callback
2223
from opentelemetry.trace import Tracer
2324

@@ -113,3 +114,9 @@ def test_uninstrument_channel_functions(self) -> None:
113114
self.channel.basic_publish._original_function = original_function
114115
PikaInstrumentor._uninstrument_channel_functions(self.channel)
115116
self.assertEqual(self.channel.basic_publish, original_function)
117+
118+
def test_consumer_callback_attribute_name(self) -> None:
119+
with mock.patch("pika.__version__", "1.0.0"):
120+
assert _consumer_callback_attribute_name() == "on_message_callback"
121+
with mock.patch("pika.__version__", "0.12.0"):
122+
assert _consumer_callback_attribute_name() == "consumer_cb"

0 commit comments

Comments
 (0)