I want to save json output via docker k6.
This works well.
docker run -i -v $(pwd):/ci/ loadimpact/k6:latest run /ci/performance-test.js
But this does not work well.
docker run -i -v $(pwd):/ci/ loadimpact/k6:latest run --out json=/ci/result.json /ci/performance-test.js
time="2021-04-03T04:09:20Z" level=error msg="open /ci/result.json: permission denied"
Do you have any suggestions?
Save json when using docker to run k6 - k6 support - k6 community forum Save json when using docker to run k6
I read it, but I don’t solve my issue yet.
This is minimal reproduce.
I tried this: k6 io/blog/integrating-load-testing-with-circleci
Chances are that the directory you mount has write access only for
your user, but k6 runs with a non-root user that has UID 12345 by default.
You can fix that with
--user $UID to your arguments.
$ docker run -i -v $(pwd):/ci/ --user $UID loadimpact/k6:latest run --out json=/ci/result.json /ci/performance-test.js
and I can use it on circleci!
This is circleci example:
This file has been truncated.
name: Running k6 tests
# Download the k6 docker image. Alternatively, download the k6 release binary
# Mount a volume to access the folder and run the test
docker run \
-v $(pwd):/ci/ \
--user $UID \
--out json=/ci/performance/full.json \
And I want to update this article
Load testing with CircleCI