From 6e1429e5182dbe72b97183d2001e13f4c28efaec Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Wed, 21 Aug 2024 10:44:55 -0600 Subject: [PATCH] Handle case when first value is `0` in `test_cumulative_aggregation_with_random_data` (#4139) --- .../test_exponential_bucket_histogram_aggregation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py b/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py index 85c28070c1..7d025e3330 100644 --- a/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py +++ b/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py @@ -1043,14 +1043,15 @@ def collect_and_validate(values, histogram) -> None: # run this test case with the same values used in a previous execution, # check the value printed by that previous execution of this test case # and use the same value for the seed variable in the line below. - # seed = 4539544373807492135 + # seed = 3373389994391084876 random_generator = Random(seed) print(f"seed for {currentframe().f_code.co_name} is {seed}") values = [] for i in range(2000): - value = random_generator.randint(0, 1000) + # avoid both values being 0 + value = random_generator.randint(0 if i else 1, 1000) values.append(value) histogram.aggregate(Measurement(value, Mock())) if i % 20 == 0: