0

When testing API using locust distributed mode without UI in docker. The distribution.csv, requests.csv are getting generated but the failures.csv and expection.csv are not getting generated but the requests.csv show failures as given below.

"Method","Name","# requests","# failures","Median response time","Average response time","Min response time","Max response time","Average Content Size","Requests/s"
"POST","/api/something/something",197009,56,470,559,78,156714,1,436.31

Can you please help.

Peter Staranchuk
  • 1,343
  • 3
  • 14
  • 29
Wasim Ansari
  • 260
  • 1
  • 4
  • Hi! Can you give some more details? What are you running exactly? Have you tried running without docker? – Cyberwiz Dec 25 '19 at 19:05
  • Hi! I am running load test of a Api using locust using the command "locust -f locustTestFile.py --csv=example --no-web -c 1000 -r 100 --run-time 1h30m". So my question is when I run load test using the "web mode", I can download the failures.csv and error.csv for the failure during the test execution. But when when I am running using "--no-web" mode, there is no failure.csv or error.csv created even when error occurs. – Wasim Ansari Jan 16 '20 at 07:30

1 Answers1

2

The problem is that file need to be written to a folder that it has permission to, and a volume that is mounted to your host. If you add a mounted folder before the file name, it should work. For example:

Docker file:

# Set base image
FROM locustio/locust
ADD locustfile.py locustfile.py

Docker create Command:

docker build -t mykey/myimage:1.0 .

Docker run command (on Windows, replace with %CD% with $pwd on linux):

docker run --volume "%CD%:/mnt/locust" -e LOCUSTFILE_PATH=/mnt/locust/locustfile.py -e TARGET_URL=https://example.com -e LOCUST_OPTS="--clients=10 --no-web --run-time=600 --csv=/mnt/locust/output" mykey/myimage:1.0

The files will now write to the same folder where locustfile.py is located.