diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py index 89cf7f66391..5c8f0407254 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py @@ -24,6 +24,7 @@ from opentelemetry.attributes import BoundedAttributes from opentelemetry.exporter.otlp.proto.grpc.exporter import ( + _is_backoff_v2, _translate_key_values, ) from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import ( @@ -461,7 +462,8 @@ def test_otlp_headers(self, mock_ssl_channel, mock_secure): def test_handles_backoff_v2_api(self, mock_sleep, mock_backoff): # In backoff ~= 2.0.0 the first value yielded from expo is None. def generate_delays(*args, **kwargs): - yield None + if _is_backoff_v2: + yield None yield 1 mock_backoff.expo.configure_mock(**{"side_effect": generate_delays}) diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py index 99f9ea12d31..45bc0c6faaf 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py @@ -25,6 +25,7 @@ DEFAULT_METRICS_EXPORT_PATH, DEFAULT_TIMEOUT, OTLPMetricExporter, + _is_backoff_v2, ) from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_OTLP_CERTIFICATE, @@ -281,7 +282,8 @@ def test_serialization(self, mock_post): def test_handles_backoff_v2_api(self, mock_sleep, mock_backoff): # In backoff ~= 2.0.0 the first value yielded from expo is None. def generate_delays(*args, **kwargs): - yield None + if _is_backoff_v2: + yield None yield 1 mock_backoff.expo.configure_mock(**{"side_effect": generate_delays}) diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py index 7dcb82030d4..b273a618cf9 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py @@ -29,6 +29,7 @@ DEFAULT_LOGS_EXPORT_PATH, DEFAULT_TIMEOUT, OTLPLogExporter, + _is_backoff_v2, ) from opentelemetry.exporter.otlp.proto.http._log_exporter.encoder import ( _encode_attributes, @@ -166,7 +167,8 @@ def test_serialize(self): def test_handles_backoff_v2_api(self, mock_sleep, mock_backoff): # In backoff ~= 2.0.0 the first value yielded from expo is None. def generate_delays(*args, **kwargs): - yield None + if _is_backoff_v2: + yield None yield 1 mock_backoff.expo.configure_mock(**{"side_effect": generate_delays}) diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py index 73d08e08c8c..64ca6fbbb86 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py @@ -26,6 +26,7 @@ DEFAULT_TIMEOUT, DEFAULT_TRACES_EXPORT_PATH, OTLPSpanExporter, + _is_backoff_v2, ) from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_OTLP_CERTIFICATE, @@ -203,7 +204,8 @@ def test_headers_parse_from_env(self): def test_handles_backoff_v2_api(self, mock_sleep, mock_backoff): # In backoff ~= 2.0.0 the first value yielded from expo is None. def generate_delays(*args, **kwargs): - yield None + if _is_backoff_v2: + yield None yield 1 mock_backoff.expo.configure_mock(**{"side_effect": generate_delays})