From 159d9308cde3a6d5591440021ebf9ea6bc183816 Mon Sep 17 00:00:00 2001 From: Vasil Danielov Pashov Date: Fri, 20 Dec 2024 23:15:46 +0200 Subject: [PATCH] Fix flaky resampling test (#2090) #### Reference Issues/PRs #### What does this implement or fix? The rules for generating offset and rule can generate huge numbers which are later converted to nanoseconds. The operations performed on the nanoseconds can overflow. This adds max_value limitation to the generators. #### Any other comments? #### Checklist
Checklist for code changes... - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?
--- python/tests/hypothesis/arcticdb/test_resample.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/hypothesis/arcticdb/test_resample.py b/python/tests/hypothesis/arcticdb/test_resample.py index e263211e92..5d057e666b 100644 --- a/python/tests/hypothesis/arcticdb/test_resample.py +++ b/python/tests/hypothesis/arcticdb/test_resample.py @@ -54,7 +54,7 @@ def freq_fits_in_64_bits(count, unit): @st.composite def rule(draw): - count = draw(st.integers(min_value=1)) + count = draw(st.integers(min_value=1, max_value=10_000)) unit = draw(st.sampled_from(['min', 'h'])) result = f"{count}{unit}" assume(freq_fits_in_64_bits(count=count, unit=unit)) @@ -65,7 +65,7 @@ def offset(draw): unit = draw(st.sampled_from(['s', 'min', 'h', None])) if unit is None: return None - count = draw(st.integers(min_value=1)) + count = draw(st.integers(min_value=1, max_value=10_000)) result = f"{count}{unit}" assume(freq_fits_in_64_bits(count=count, unit=unit)) return result