feat: add abortAfterTimeLapsedInSeconds support to ExecutorServiceRunner #735
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request implements the
abort.after.time.lapsed.in.secondsfeature to allow load tests to be automatically aborted after a specified time period. It adds a timeout mechanism to theExecutorServiceRunnerclass that checks elapsed time at key points during test execution and throws a runtime exception if the configured timeout is exceeded.Checklist
Proof that changes are correct
The implementation adds a new
abortAfterTimeLapsedInSecondsfield and parameter to theExecutorServiceRunnerconstructor. The timeout check is performed at multiple points in the execution flow:The timeout check is wrapped in a private
isTimeoutExceededmethod that compares the elapsed time since the start of the test with the configured timeout. When the timeout is exceeded, a runtime exception is thrown and the executor service is shut down. This ensures that tests will not run indefinitely and can be controlled by the configured timeout value.