Skip to content

Commit 06dee51

Browse files
committed
Fix broken tests
1 parent 1e68c3c commit 06dee51

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,11 @@ def _init_exporter(
257257
]
258258
] = None,
259259
) -> Union[SpanExporter, MetricExporter, LogExporter]:
260-
otlp_credential_param_for_signal_type = _load_credential_from_envvar(
261-
_EXPORTER_CREDENTIAL_BY_SIGNAL_TYPE[signal_type]
262-
)
260+
# Per signal type envvar should take precedence over all signal type env var.
263261
otlp_credential_param = (
264-
otlp_credential_param_for_signal_type
262+
_load_credential_from_envvar(
263+
_EXPORTER_CREDENTIAL_BY_SIGNAL_TYPE[signal_type]
264+
)
265265
or otlp_credential_param_for_all_signal_types
266266
)
267267
if not otlp_credential_param:

opentelemetry-sdk/tests/test_configurator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ def test_logging_init_disable_default(self, logging_mock, tracing_mock):
734734
_initialize_components(auto_instrumentation_version="auto-version")
735735
self.assertEqual(tracing_mock.call_count, 1)
736736
logging_mock.assert_called_once_with(
737-
mock.ANY, mock.ANY, False, exporter_args_map=None
737+
mock.ANY, mock.ANY, False, otlp_credential_param=None, exporter_args_map=None
738738
)
739739

740740
@patch.dict(
@@ -750,7 +750,7 @@ def test_logging_init_enable_env(self, logging_mock, tracing_mock):
750750
with self.assertLogs(level=WARNING):
751751
_initialize_components(auto_instrumentation_version="auto-version")
752752
logging_mock.assert_called_once_with(
753-
mock.ANY, mock.ANY, True, exporter_args_map=None
753+
mock.ANY, mock.ANY, True, otlp_credential_param=None, exporter_args_map=None
754754
)
755755
self.assertEqual(tracing_mock.call_count, 1)
756756

@@ -868,17 +868,20 @@ def test_initialize_components_kwargs(
868868
id_generator="TEST_GENERATOR",
869869
sampler="TEST_SAMPLER",
870870
resource="TEST_RESOURCE",
871+
otlp_credential_param=None,
871872
exporter_args_map={1: {"compression": "gzip"}},
872873
)
873874
metrics_mock.assert_called_once_with(
874875
"TEST_METRICS_EXPORTERS_DICT",
875876
"TEST_RESOURCE",
877+
otlp_credential_param=None,
876878
exporter_args_map={1: {"compression": "gzip"}},
877879
)
878880
logging_mock.assert_called_once_with(
879881
"TEST_LOG_EXPORTERS_DICT",
880882
"TEST_RESOURCE",
881883
True,
884+
otlp_credential_param=None,
882885
exporter_args_map={1: {"compression": "gzip"}},
883886
)
884887

0 commit comments

Comments
 (0)