Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shutdown workers when using LoadTestShape and headless mode #1683

Merged
merged 1 commit into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def timelimit_stop():
if options.run_time:
logger.info("Run time limit set to %s seconds" % options.run_time)
spawn_run_time_limit_greenlet()
elif options.headless and not options.worker:
elif options.headless and not options.worker and not environment.shape_class:
logger.info("No run time limit set, use CTRL+C to interrupt.")
else:
pass # dont log anything - not having a time limit is normal when not running headless
Expand Down
5 changes: 4 additions & 1 deletion locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ def shape_worker(self):
new_state = self.environment.shape_class.tick()
if new_state is None:
logger.info("Shape test stopping")
self.stop()
if self.environment.parsed_options.headless:
self.quit()
else:
self.stop()
elif self.shape_last_state == new_state:
gevent.sleep(1)
else:
Expand Down
1 change: 1 addition & 0 deletions locust/test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def tick(self):
)
self.assertIn("Shape test updating to 10 users at 1.00 spawn rate", output)
self.assertIn("Cleaning up runner...", output)
self.assertIn("Quitting...", output)

def test_web_options(self):
port = get_free_tcp_port()
Expand Down