Skip to content

Commit

Permalink
Tried to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pridhi-arora committed Dec 12, 2022
1 parent fccf547 commit b17d41f
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def Export(self, request, context):


class TestOTLPLogExporter(TestCase):
def setUp(self):

def setUp(self):
self.exporter = OTLPLogExporter()

self.server = server(ThreadPoolExecutor(max_workers=10))
Expand Down Expand Up @@ -182,26 +182,26 @@ def test_exporting(self):
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: "logs:4317",
OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE: THIS_DIR
+ "/fixtures/test.cert",
OTEL_EXPORTER_OTLP_LOGS_HEADERS: " key1=value1,KEY2 = value=2",
OTEL_EXPORTER_OTLP_LOGS_HEADERS: " key1=value1,KEY2 = VALUE=2",
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: "10",
OTEL_EXPORTER_OTLP_LOGS_COMPRESSION: "gzip",
},
)
@patch(
"opentelemetry.exporter.otlp.proto.grpc.exporter.OTLPExporterMixin.__init__"
)
def test_env_variables(self, mock_exporter_mixin):
print("*************************")
print(mock_exporter_mixin.call_args_list)
self.assertTrue(len(mock_exporter_mixin.call_args_list) == 1)
_, kwargs = mock_exporter_mixin.call_args_list[0]

self.assertEqual(kwargs["endpoint"], "log:4317")
self.assertEqual(kwargs["headers"], " key1=value1,KEY2 = value=2")
self.assertEqual(kwargs["timeout"], 10)
self.assertEqual(kwargs["compression"], Compression.Gzip)
self.assertIsNotNone(kwargs["credentials"])
self.assertIsInstance(kwargs["credentials"], ChannelCredentials)
def test_env_variables(self):
exporter = OTLPLogExporter()
self.assertEqual(exporter._endpoint, "logs:4317")
self.assertEqual(exporter._timeout, 10)
self.assertEqual(exporter._compression, Compression.Gzip)
self.assertIsNotNone(exporter._credentials)
self.assertIsInstance(exporter._credentials, ChannelCredentials)
self.assertEqual(
exporter._headers,
(
("key1", "value1"),
("key2", "VALUE=2"),
("user-agent", "OTel OTLP Exporter Python/" + __version__),
),
)

@patch(
"opentelemetry.exporter.otlp.proto.grpc.exporter.ssl_channel_credentials"
Expand Down

0 comments on commit b17d41f

Please sign in to comment.