Gerard
March 3, 2022, 1:48pm
#1
Hi Team,
I’m running a test on docker, but the html report i generated missing on the docker volume I mounted.
I refer the below thread and run the test based on the details shared on the thread.
tested quickly with the below command which did not save any new files to the host machine. Or the files are saved in the working directory specified in k6 Dockerfile and that has to be mapped to the host machine ?
import http from “k6/http”;
import { check } from “k6”;
import { jUnit, textSummary } from ‘https://jslib.k6.io/k6-summary/0.0.1/index.js ’;
export default function () {
check(http.get(“https://test-api.k6.io/ ”), {
“status is 200”: (r) => r.status == 200
});
}
export function…
docker run -it --user “$(id -u $USER)” -e “TEST_PROFILE=${TEST_PROFILE}” -v ${CODEBUILD_SRC_DIR}/src:/src --workdir “/src” -i loadimpact/k6 run --out influxdb=http://influxdb:8086/grafana /src/tests/app1/index.js
Test runs perfectly, and it shows the generating summary report but still i can’t find the report.
Hi @Gerard !
I checked using a minimal example:
import { sleep } from "k6";
import http from 'k6/http';
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js";
export default function () {
http.get("http://test.k6.io");
sleep(1);
}
export function handleSummary(data) {
return {
'./summary.json': JSON.stringify(data),
"./summary.html": htmlReport(data),
}
}
And it seems to work
After executing a command on my local machine:
docker run -it --user "$(id -u $USER)" -v $(pwd):/src --workdir "/src" -i grafana/k6 run /src/script.js
There are two reports generated:
├── script.js
├── summary.html
└── summary.json
So, I suggest trying to experiment with this to understand where the issue can be.
Cheers
Gerard
March 9, 2022, 4:00am
#5
Thanks @olegbespalov ,
Yes from my end --workdir not set to /src folder, therefore the report not generated inside the /src/ folder. I found out the default workdir for k6 docker set to /home/k6/ and all the reports were generated there.