Fix false "--run-time limit reached" log message when shape test completes#3382
Merged
cyberw merged 1 commit intolocustio:masterfrom Mar 25, 2026
Conversation
…letes When a LoadTestShape test finishes naturally or is interrupted, stop_and_optionally_quit() logs "--run-time limit reached" even though the stop was not caused by the --run-time limit. This is misleading for users. Add a `reason` parameter to stop_and_optionally_quit() that defaults to "--run-time limit reached" (preserving existing behavior for the timer-based call) and pass "Shape test completed" when called from the shape class finally block. Fixes locustio#3178
Collaborator
|
Nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
--run-time limit reachedlog message that appears when aLoadTestShapetest completes naturally or is interrupted, even though the stop was not caused by the--run-timelimit.reasonparameter tostop_and_optionally_quit()(defaults to"--run-time limit reached"for backward compatibility) and passes"Shape test completed"from the shape classfinallyblock.Fixes #3178
Context
As noted in #3178, calling
stop()/quit()or letting aLoadTestShapefinish naturally would print--run-time limit reached, shutting down(orstopping test), which is incorrect and confusing since the stop was not triggered by--run-time. A maintainer acknowledged this as a valid bug but it was closed as stale with no fix applied.Changes
locust/main.py:stop_and_optionally_quit()now takes an optionalreasonparameter. The timer-based call (spawn_run_time_quit_greenlet) still passes the default"--run-time limit reached". The shape classfinallyblock now passes"Shape test completed".locust/test/test_main.py: Updated two shape-class integration tests (test_autostart_w_load_shapeandtest_autostart_multiple_locustfiles_with_shape) to expect"Shape test completed"instead of"--run-time limit reached".Test plan
test_main.pyandtest_log.pythat verify--run-time limit reachedfor actual timer-triggered stops remain unchanged and should pass"Shape test completed"LoadTestShapewith--autostartand verify the log says"Shape test completed, stopping test"instead of"--run-time limit reached, stopping test"