Skip to content

Commit

Permalink
Handle case when first value is 0 in `test_cumulative_aggregation_w…
Browse files Browse the repository at this point in the history
…ith_random_data` (#4139)
  • Loading branch information
ocelotl committed Aug 21, 2024
1 parent 110bb73 commit 6e1429e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6e1429e

Please sign in to comment.