locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
25.06k stars 3k forks source link

Run locust with 1 concurrent users on 3 Locust clients exit without warnings/errors #989

Closed ztou closed 5 years ago

ztou commented 5 years ago

Description of issue

when there are 3 locust clients, but run with only 1 concurrent Locust users, locust exit without error or warning.

https://github.com/locustio/locust/blob/8b17c286034178ba31c6d48b93f29202514f5659/locust/runners.py#L83

num_locusts could be 0

Expected behavior

num_locusts should be at least 1

Actual behavior

num_locusts is 0

Steps to reproduce (for bug reports)

when there are 3 locust clients, but run with only 1 concurrent Locust users like below, locust exit without error or warning.

locust -f l.py --host=http://127.0.0.1:5000 --no-web -c 1 -r 1

l.py as below:

class T1(TaskSet):
    @task
    def test1(self):
        self.client.get("/test1")

class T2(TaskSet):
    @task
    def test2(self):
        self.client.get("/test2")

class T3(TaskSet):
    @task
    def test3(self):
        self.client.get("/test3")

class User1(HttpLocust):
    task_set = T1

class User2(HttpLocust):
    task_set = T2

class User3(HttpLocust):
    task_set = T3
ztou commented 5 years ago

add a simple fix for your reference - https://github.com/locustio/locust/pull/990

delulu commented 5 years ago

you haven't consider the situation where zero locust is spawn, so there's one test failure test_spawn_zero_locusts.

heyman commented 5 years ago

I believe this was fixed by #1113