Skip to content

Conversation

@weillercarvalho
Copy link

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

  • 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:

  • My code follows the code style of this project.

  • I have updated the documentation accordingly.

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.

RandomDate ignores inclusive end date and throws when start == end

1 participant