Closed varvarvarvar closed 1 day ago
Interesting. I dont remember if this was a deliberate change or an accidental one, and I'm not sure which version makes the most sense/is most expected. Probably want to leave it as is, but we could document it better.
At some point there was a risk that Users got started before test_start had finished, maybe that was the behaviour in 1.x.
This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!
I'll try to fix this soon...
Hmm. I took another swing at this, but it's really hard to do without some serious refactoring.
The main function doesn't know anything about test_start, and the Runner (that calls test_start) can't stop the whole test, even if we told it about the run time, because it has no idea about things like the web UI, that need to be shut down.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.
This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!
Describe the bug
The behaviour of
--run-time
argument has changed since the upgrade to v2. In later versions, it controls the total duration of the test includingtest_start
event, while in v1 it doesn't include the duration oftest_start
event.I looked through Changelog Highlights and github issues, but couldn't find any information about it.
Expected behavior
If we run a load test with
locust 1.6.0
and specify--run-time 15s
,test_start
event is executed before we set the time limit of 15s:Actual behavior
If we run a load test with
locust 2.15.1
and specify--run-time 15s
, the duration oftest_start
event is included in these 15s:Steps to reproduce
Run the specified command on locustfile.py with locust 1.6.0 and 2.15.1.
Environment
from locust import HttpUser, events, task
@events.test_start.add_listener def on_test_start(environment, **kw): logging.info("Starting on_test_start") time.sleep(15) logging.info("Ending on_test_start")
class WebsiteUser(HttpUser): @task def myfunc(self): logging.info("Testing myfunc")