From 6d1c740effe8c9d9a1b65e0d77497d9cefdd805e Mon Sep 17 00:00:00 2001 From: Shalev Roda <65566801+shalevr@users.noreply.github.com> Date: Sun, 1 Jan 2023 23:06:56 +0200 Subject: [PATCH] Add uninstrument test for boto3sqs (#1550) --- .../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 102e40693..a6ca0e062 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 @@ class TestBoto3SQSInstrumentation(TestBase): 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))