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

locust:2.7.1 exits when clicking "Stop Tests" in the UI #1995

Closed
fluxx-sleblanc opened this issue Feb 3, 2022 · 1 comment · Fixed by #1996
Closed

locust:2.7.1 exits when clicking "Stop Tests" in the UI #1995

fluxx-sleblanc opened this issue Feb 3, 2022 · 1 comment · Fixed by #1996
Labels

Comments

@fluxx-sleblanc
Copy link

fluxx-sleblanc commented Feb 3, 2022

Describe the bug

When using the 2.7.1 docker image, locust exits with code 0 upon clicking "Stop Tests" in the UI.
We swapped in 2.7.0 with the same locustfile and config, and the problem was fixed.

Expected behavior

Locust should continue running (as it does in 2.7.0) after clicking "Stop Tests".

Actual behavior

Cannot run multiple tests, as after each test locust exits, therefore we can't compare results from previous runs.

Steps to reproduce

  1. Run locust:2.7.1 docker image
  2. Browse to the UI
  3. Start tests
  4. Stop tests
  5. Observe that locust has exited

Environment

  • OS: locustio:locust:2.7.1 docker image
  • Python version: 3.9 (locustio:locust:2.7.1 docker image)
  • Locust version: 2.7.1
  • Locust command line that you ran: locust --config=/home/locust/master.conf
  • Locust file contents (anonymized if necessary):
import time
import os
from locust import HttpUser, FastHttpUser, task, events
from locust.runners import MasterRunner
from kubernetes import client, config
from kubernetes.stream import stream


API_TOKEN = ""  # currently not used


# Basic requests that sleep - for testing queue latency with Puma
class SleepUser(FastHttpUser):
    network_timeout = 300

    @task(3)
    def sleep_one(self):
        self.client.get("/sleep?time=1", verify=False)

    @task(2)
    def sleep_five(self):
        self.client.get("/sleep?time=5", verify=False)

    @task(5)
    def sleep_half(self):
        self.client.get("/sleep?time=0.5", verify=False)

    @task(1)
    def sleep_thirty(self):
        self.client.get("/sleep?time=30", verify=False)


# Hook that runs when locust starts
@events.test_start.add_listener
def on_test_start(environment, **kwargs):
    print("Starting on_test_start hook")
    generate_api_token_script = # removed
    success, output = execute_on_app_pod(generate_api_token_script)
    global API_TOKEN
    API_TOKEN = [line for line in output.split('\n') if 'PERFAPITOKEN:' in line][1].replace('PERFAPITOKEN:', '')


def execute_on_app_pod(command):
    # removed - function that executes commands on an in-cluster k8s pod

locust conf:

users = 100
spawn-rate = 10
web-host: *
web-port: 8089

env vars:
LOCUST_HOST= # url we're testing
LOCUST_LOCUSTFILE=/home/locust/locustfile.py

cyberw added a commit that referenced this issue Feb 3, 2022
@cyberw
Copy link
Collaborator

cyberw commented Feb 3, 2022

Damn, that's bad. I need to add better unit tests for the web ui. Can you check the latest prerelease (pip install -U --pre locust) build (or latest master) and see if I managed to fix it?

The version should be available in a couple minutes and be called something like 2.7.2.devX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants