Open takearun opened 6 years ago
Was wondering the same. I'm starting to think it's impossible.
on a unix computer you could use a grep command, on windows you should download search everything.
Since slowhttptest saves files to the current directory and doesn't have a way to specify an output folder or name output files, you can accomplish this by creating a bind mount between the host and container, and telling docker where to set the working directory when it starts. I'm an idiot.
Here's one way to do it.
user@host:~$ mkdir output
user@host:~$ sudo docker run -v /home/user/output:/output -w /output shekyan/slowhttptest:latest -c 100 -H -g -i 10 -r 20 -t GET -u https://localhost/api/resources/365037?api-key=1234 -p 10
... wait ...
user@host:~$ ls -l output/
total 8
-rw-r--r-- 1 root root 485 Oct 6 19:05 slow_2021-10-06_19-04-54.csv
-rw-r--r-- 1 root root 2861 Oct 6 19:05 slow_2021-10-06_19-04-54.html
-v /home/user/output:/output
creates /output
in the container and binds it to /home/user/output
on the host. Anything placed here will be accessible and persist on the host.-w /output
sets the working directory to /output
when the container starts. Files are saved here and will be available in /home/user/output
even after the container stops.Here's another way.
user@host:~$ mkdir output
user@host:~$ sudo docker run -v /home/user/output:/output shekyan/slowhttptest:latest -c 100 -H -g -i 10 -r 20 -t GET -u https://localhost/api/resources/365037?api-key=1234 -p 10 -o /output/my_results
... wait ...
user@host:~$ ls -l output/
total 8
-rw-r--r-- 1 root root 485 Oct 6 19:33 my_results.csv
-rw-r--r-- 1 root root 2861 Oct 6 19:33 my_results.html
-v /home/user/output:/output
creates /output
in the container and binds it to /home/user/output
on the host. Anything placed here will be accessible and persist on the host.-o /output/my_results
this -o ...
gets passed to slowhttptest and tells it to save files in that folder and/or prefix (files will end in .csv and .html)you can start the container in daemon mode, attach to this container, run the test (which generates csv/html), exit the container and copy them back to host.
docker run -d -it --entrypoint sh <image_id>
docker exec -it <container_id> sh
#now we are inside the container, at its CLI prompt
#slowhttptest execution
exit
docker cp <container_id>:my*.html .
Hi, I used the docker build to build the image and I was able to run it like this,
docker run slowhttptest:latest -c 100 -H -g -i 10 -r 20 -t GET -u https://localhost/api/resources/365037?api-key=1234 -p 10
It seemed to have ran fine and I got this output,
slow HTTP test status on 240th second:
initializing: 0 pending: 0 connected: 100 error: 0 closed: 0 service available: YES Fri Nov 16 13:48:33 2018: Test ended on 241th second Exit status: Hit test time limit CSV report saved to slow_2018-11-16_13-44-32.csv HTML report saved to slow_2018-11-16_13-44-32.html
Now where are the csv and html files stored?
Thanks, Arun