Skip to content

Commit

Permalink
distro: decouple default configuration test from environment (#2561)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx committed May 28, 2024
1 parent ac97b00 commit f7cef14
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions opentelemetry-distro/tests/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# type: ignore

import os
from unittest import TestCase
from unittest import TestCase, mock

from pkg_resources import DistributionNotFound, require

Expand All @@ -33,17 +33,10 @@ def test_package_available(self):
except DistributionNotFound:
self.fail("opentelemetry-distro not installed")

@mock.patch.dict("os.environ", {}, clear=True)
def test_default_configuration(self):
distro = OpenTelemetryDistro()
self.assertIsNone(os.environ.get(OTEL_TRACES_EXPORTER))
self.assertIsNone(os.environ.get(OTEL_METRICS_EXPORTER))
distro.configure()
self.assertEqual(
"otlp", os.environ.get(OTEL_TRACES_EXPORTER)
)
self.assertEqual(
"otlp", os.environ.get(OTEL_METRICS_EXPORTER)
)
self.assertEqual(
"grpc", os.environ.get(OTEL_EXPORTER_OTLP_PROTOCOL)
)
self.assertEqual("otlp", os.environ.get(OTEL_TRACES_EXPORTER))
self.assertEqual("otlp", os.environ.get(OTEL_METRICS_EXPORTER))
self.assertEqual("grpc", os.environ.get(OTEL_EXPORTER_OTLP_PROTOCOL))

0 comments on commit f7cef14

Please sign in to comment.