Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e1429e

Browse files
authored
Handle case when first value is 0 in test_cumulative_aggregation_with_random_data (open-telemetry#4139)
1 parent 110bb73 commit 6e1429e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,14 +1043,15 @@ def collect_and_validate(values, histogram) -> None:
10431043
# run this test case with the same values used in a previous execution,
10441044
# check the value printed by that previous execution of this test case
10451045
# and use the same value for the seed variable in the line below.
1046-
# seed = 4539544373807492135
1046+
# seed = 3373389994391084876
10471047

10481048
random_generator = Random(seed)
10491049
print(f"seed for {currentframe().f_code.co_name} is {seed}")
10501050

10511051
values = []
10521052
for i in range(2000):
1053-
value = random_generator.randint(0, 1000)
1053+
# avoid both values being 0
1054+
value = random_generator.randint(0 if i else 1, 1000)
10541055
values.append(value)
10551056
histogram.aggregate(Measurement(value, Mock()))
10561057
if i % 20 == 0:

0 commit comments

Comments
 (0)