From 03b24809bfecc22b2f000394d412b48c14fd4643 Mon Sep 17 00:00:00 2001 From: Mario Jonke Date: Mon, 23 Nov 2020 17:03:11 +0100 Subject: [PATCH] Fix OTLP exporter config tests (#1395) --- .../tests/test_otlp_metric_exporter.py | 6 +++++- .../tests/test_otlp_trace_exporter.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/exporter/opentelemetry-exporter-otlp/tests/test_otlp_metric_exporter.py b/exporter/opentelemetry-exporter-otlp/tests/test_otlp_metric_exporter.py index 4f121b38fda..308d217f21b 100644 --- a/exporter/opentelemetry-exporter-otlp/tests/test_otlp_metric_exporter.py +++ b/exporter/opentelemetry-exporter-otlp/tests/test_otlp_metric_exporter.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os from collections import OrderedDict from unittest import TestCase from unittest.mock import patch @@ -44,6 +45,8 @@ from opentelemetry.sdk.metrics.export.aggregate import SumAggregator from opentelemetry.sdk.resources import Resource as SDKResource +THIS_DIR = os.path.dirname(__file__) + class TestOTLPMetricExporter(TestCase): @patch("opentelemetry.sdk.metrics.export.aggregate.time_ns") @@ -75,7 +78,8 @@ def tearDown(self): "os.environ", { "OTEL_EXPORTER_OTLP_METRIC_ENDPOINT": "collector:55680", - "OTEL_EXPORTER_OTLP_METRIC_CERTIFICATE": "fixtures/test.cert", + "OTEL_EXPORTER_OTLP_METRIC_CERTIFICATE": THIS_DIR + + "/fixtures/test.cert", "OTEL_EXPORTER_OTLP_METRIC_HEADERS": "key1:value1;key2:value2", "OTEL_EXPORTER_OTLP_METRIC_TIMEOUT": "10", }, diff --git a/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py b/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py index 742ab29bc95..4445873aaf6 100644 --- a/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py +++ b/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os from collections import OrderedDict from concurrent.futures import ThreadPoolExecutor from unittest import TestCase @@ -53,6 +54,8 @@ ) from opentelemetry.sdk.util.instrumentation import InstrumentationInfo +THIS_DIR = os.path.dirname(__file__) + class TraceServiceServicerUNAVAILABLEDelay(TraceServiceServicer): # pylint: disable=invalid-name,unused-argument,no-self-use @@ -165,7 +168,8 @@ def tearDown(self): "os.environ", { "OTEL_EXPORTER_OTLP_SPAN_ENDPOINT": "collector:55680", - "OTEL_EXPORTER_OTLP_SPAN_CERTIFICATE": "fixtures/test.cert", + "OTEL_EXPORTER_OTLP_SPAN_CERTIFICATE": THIS_DIR + + "/fixtures/test.cert", "OTEL_EXPORTER_OTLP_SPAN_HEADERS": "key1:value1;key2:value2", "OTEL_EXPORTER_OTLP_SPAN_TIMEOUT": "10", },