You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "weillercarvalho (via GitHub)" <gi...@apache.org> on 2025/11/17 19:42:40 UTC
[PR] RandomDate: include end date and handle single-day ranges [jmeter]
weillercarvalho opened a new pull request, #6610:
URL: https://github.com/apache/jmeter/pull/6610
## Description
RandomDate now picks inclusive date ranges by delegating the day selection to a new `pickRandomDay(...)` helper. That method returns the single-day range immediately and otherwise calls `ThreadLocalRandom.nextLong(start, end + 1)` using `Math.incrementExact`, so the configured end date can be emitted and `start == end` no longer throws. The tests for `__RandomDate` were updated to accept both bounds and now include explicit coverage for the single-day case and for ensuring the end date eventually appears.
## Motivation and Context
Fixes #6609 . The current implementation treats the end date as exclusive and blows up when both bounds are equal, which makes it impossible to configure fixed dates or truly closed intervals in test plans.
## How Has This Been Tested?
- `./gradlew :src:functions:test --tests org.apache.jmeter.functions.TestTimeRandomDateFunction`
- `./gradlew check` (fails in `:src:protocol:bolt:test` due to the flaky `BoltSamplerTest.should ignore invalid timeout values()`
timeout; unrelated to this change)
## Screenshots (if appropriate):
n/a
## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
## Checklist:
- [x] My code follows the [code style][style-guide] of this project.
- [ ] I have updated the documentation accordingly.
[style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org