From 341131c2a296949f1b4a6262264ae6202c4e390e Mon Sep 17 00:00:00 2001 From: sroda Date: Tue, 27 Dec 2022 15:05:49 +0200 Subject: [PATCH] Add uninstrument test for boto3sqs --- .../tests/test_boto3sqs_instrumentation.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/tests/test_boto3sqs_instrumentation.py b/instrumentation/opentelemetry-instrumentation-boto3sqs/tests/test_boto3sqs_instrumentation.py index 102e40693c..a6ca0e062b 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/tests/test_boto3sqs_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/tests/test_boto3sqs_instrumentation.py @@ -311,3 +311,27 @@ def test_receive_message(self): self.assertEqual(attrs["span_id"], link.context.span_id) self.memory_exporter.clear() + + def test_uninstrument(self): + mock_response = { + "MessageId": "123456789", + } + + with self._mocked_endpoint(mock_response): + self._client.send_message( + QueueUrl=self._queue_url, + MessageBody="test", + ) + + spans = self.get_finished_spans() + self.assertEqual(1, len(spans)) + + self.memory_exporter.clear() + Boto3SQSInstrumentor().uninstrument() + + self._client.send_message( + QueueUrl=self._queue_url, + MessageBody="test", + ) + spans = self.get_finished_spans() + self.assertEqual(0, len(spans))