Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Interrupt predicates when interruptAfterTimeLimit #3507

Merged
merged 5 commits into from Dec 22, 2022
Merged

Conversation

dubzzz
Copy link
Owner

@dubzzz dubzzz commented Dec 22, 2022

In the context of #3084, we want to have a way built-in in fast-check to make sure that tests do not run for too long and can abide by certain timeouts constraints requested by the users.

While today we do have a timeout, it only scopes the interruption to one run of the predicate but does not consider "the runs" as a whole contrary to interruptAfterTimeLimit.

On the other hand, interruptAfterTimeLimit does have a timeout like behaviour but once started the predicate is never interrupted. Now it could be interrupted in-between, if running it until the end would cause a timeout given the time constraint passed to interruptAfterTimeLimit.

With such new feature in place, we will probably have to consider properties not having run at least once as failure, otherwise a buggy async algorithm would be marked as failure if it led to timeout at first run with interruptAfterTimeLimit.

Category:

  • ✨ Introduce new features
  • 📝 Add or update documentation
  • ✅ Add or update tests
  • 🐛 Fix a bug
  • 🏷️ Add or update types
  • ⚡️ Improve performance
  • Other(s): ...

Potential impacts:

  • Generated values
  • Shrink values
  • Performance
  • Typings
  • Other(s): ...

In the context of #3084, we want to have a way built-in in fast-check to make sure that tests do not run for too long and can abide by certain timeouts constraints requested by the users.

While today we do have a timeout, it only scopes the interruption to one run of the predicate but does not consider "the runs" as a whole contrary to `interruptAfterTimeLimit`.

On the other hand, `interruptAfterTimeLimit` does have a timeout like behaviour but once started the predicate is never interrupted. Now it could be interrupted in-between, if running it until the end would cause a timeout given the time constraint passed to `interruptAfterTimeLimit`.

With such new feature in place, we will probably have to consider properties not having run at least once as failure, otherwise a buggy async algorithm would be marked as failure if it led to timeout at first run with `interruptAfterTimeLimit`.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 22, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 31c8487:

Sandbox Source
Vanilla Configuration
@fast-check/examples Configuration

@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Merging #3507 (31c8487) into main (36a7d2c) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3507      +/-   ##
==========================================
- Coverage   95.49%   95.48%   -0.01%     
==========================================
  Files         213      213              
  Lines        5876     5890      +14     
  Branches     1090     1091       +1     
==========================================
+ Hits         5611     5624      +13     
- Misses        265      266       +1     
Flag Coverage Δ
unit-tests 95.48% <100.00%> (-0.01%) ⬇️
unit-tests-14.x-Linux 95.48% <100.00%> (-0.01%) ⬇️
unit-tests-16.x-Linux 95.48% <100.00%> (-0.01%) ⬇️
unit-tests-18.x-Linux 95.48% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...fast-check/src/check/property/SkipAfterProperty.ts 97.50% <100.00%> (+1.34%) ⬆️
packages/fast-check/src/arbitrary/double.ts 97.50% <0.00%> (-2.50%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@dubzzz dubzzz merged commit 0c014fe into main Dec 22, 2022
@dubzzz dubzzz deleted the interrupt-after branch December 22, 2022 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant