feat: add abortAfterTimeLapsedInSeconds support to ExecutorServiceRunner
Overview
This pull request implements the abort.after.time.lapsed.in.seconds feature to allow load tests to be automatically aborted after a specified time period. It adds a timeout mechanism to the ExecutorServiceRunner class that checks elapsed time at key points during test execution and throws a runtime exception if the configured timeout is exceeded.
Checklist
- [x] Code changes are complete
- [x] Tests pass
- [x] Documentation updated (if applicable)
Proof that changes are correct
The implementation adds a new abortAfterTimeLapsedInSeconds field and parameter to the ExecutorServiceRunner constructor. The timeout check is performed at multiple points in the execution flow:
- Before each loop iteration
- Before executing each thread
- After sleeping between threads
- While waiting for tasks to complete
The timeout check is wrapped in a private isTimeoutExceeded method 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.