From 1d3ad21b1b7dac3791895ec64e4fe40a2b645d9a Mon Sep 17 00:00:00 2001 From: Dudssource Date: Mon, 22 Jan 2024 11:19:51 -0300 Subject: [PATCH] test: moved preferred_aggregation test to class --- .../tests/test_otlp_metrics_exporter.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py index de164b1cb06..a273a6871fb 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py @@ -968,6 +968,22 @@ def test_exponential_explicit_bucket_histogram(self): ExplicitBucketHistogramAggregation, ) + def test_preferred_aggregation_override(self): + + histogram_aggregation = ExplicitBucketHistogramAggregation( + boundaries=[0.05, 0.1, 0.5, 1, 5, 10], + ) + + exporter = OTLPMetricExporter( + preferred_aggregation={ + Histogram: histogram_aggregation, + }, + ) + + self.assertEqual( + exporter._preferred_aggregation[Histogram], histogram_aggregation + ) + def _resource_metrics( index: int, scope_metrics: List[ScopeMetrics] @@ -1006,19 +1022,3 @@ def _number_data_point(value: int) -> NumberDataPoint: time_unix_nano=1641946016139533244, value=value, ) - -def test_preferred_aggregation_override(self): - - histogram_aggregation = ExplicitBucketHistogramAggregation( - boundaries=[0.05, 0.1, 0.5, 1, 5, 10], - ) - - exporter = OTLPMetricExporter( - preferred_aggregation={ - Histogram: histogram_aggregation, - }, - ) - - self.assertEqual( - exporter._preferred_aggregation[Histogram], histogram_aggregation - )