Skip to content

Commit 03b2480

Browse files
authored
Fix OTLP exporter config tests (open-telemetry#1395)
1 parent 8660dea commit 03b2480

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

exporter/opentelemetry-exporter-otlp/tests/test_otlp_metric_exporter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
1516
from collections import OrderedDict
1617
from unittest import TestCase
1718
from unittest.mock import patch
@@ -44,6 +45,8 @@
4445
from opentelemetry.sdk.metrics.export.aggregate import SumAggregator
4546
from opentelemetry.sdk.resources import Resource as SDKResource
4647

48+
THIS_DIR = os.path.dirname(__file__)
49+
4750

4851
class TestOTLPMetricExporter(TestCase):
4952
@patch("opentelemetry.sdk.metrics.export.aggregate.time_ns")
@@ -75,7 +78,8 @@ def tearDown(self):
7578
"os.environ",
7679
{
7780
"OTEL_EXPORTER_OTLP_METRIC_ENDPOINT": "collector:55680",
78-
"OTEL_EXPORTER_OTLP_METRIC_CERTIFICATE": "fixtures/test.cert",
81+
"OTEL_EXPORTER_OTLP_METRIC_CERTIFICATE": THIS_DIR
82+
+ "/fixtures/test.cert",
7983
"OTEL_EXPORTER_OTLP_METRIC_HEADERS": "key1:value1;key2:value2",
8084
"OTEL_EXPORTER_OTLP_METRIC_TIMEOUT": "10",
8185
},

exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
1516
from collections import OrderedDict
1617
from concurrent.futures import ThreadPoolExecutor
1718
from unittest import TestCase
@@ -53,6 +54,8 @@
5354
)
5455
from opentelemetry.sdk.util.instrumentation import InstrumentationInfo
5556

57+
THIS_DIR = os.path.dirname(__file__)
58+
5659

5760
class TraceServiceServicerUNAVAILABLEDelay(TraceServiceServicer):
5861
# pylint: disable=invalid-name,unused-argument,no-self-use
@@ -165,7 +168,8 @@ def tearDown(self):
165168
"os.environ",
166169
{
167170
"OTEL_EXPORTER_OTLP_SPAN_ENDPOINT": "collector:55680",
168-
"OTEL_EXPORTER_OTLP_SPAN_CERTIFICATE": "fixtures/test.cert",
171+
"OTEL_EXPORTER_OTLP_SPAN_CERTIFICATE": THIS_DIR
172+
+ "/fixtures/test.cert",
169173
"OTEL_EXPORTER_OTLP_SPAN_HEADERS": "key1:value1;key2:value2",
170174
"OTEL_EXPORTER_OTLP_SPAN_TIMEOUT": "10",
171175
},

0 commit comments

Comments
 (0)