Skip to content

Commit

Permalink
Fix flaky resampling test (#2090)
Browse files Browse the repository at this point in the history
#### Reference Issues/PRs
<!--Example: Fixes #1234. See also #3456.-->

#### 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

<details>
  <summary>
   Checklist for code changes...
  </summary>
 
- [ ] 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?
</details>

<!--
Thanks for contributing a Pull Request to ArcticDB! Please ensure you
have taken a look at:
- ArcticDB's Code of Conduct:
https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md
- ArcticDB's Contribution Licensing:
https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing
-->
  • Loading branch information
vasil-pashov authored Dec 20, 2024
1 parent 044ba06 commit 159d930
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/tests/hypothesis/arcticdb/test_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down

0 comments on commit 159d930

Please sign in to comment.