I’m running K6 on one of our Kubernetes Clusters as the Operator model. My engineering team wants to create custom module bundles with Webpack and make them available for tests.
I can’t find any documentation on where the bundles can be mounted in the Operator (manager) container. Is this possible and if so how?
If possible, I was going to have my CI build their webpack and copy it into a new image where i would combine with the existing public image.
Welcome to the forum
You can mount a volume with whatever files you need to run the test as
volumeClaim, see the docs here.
Alternatively, you can build your own image and pass it as
runner to your yaml and use
localFile option, also described in the above README. But I’d say one should try to go with the volume if possible.
Hope that helps!
I feel like I’m making a rudimentary mistake then. I have a PVC that is bound to a Pod used by my CI/CD to build and copy the modules to the Volume.
On that Pod I’m mounting to the path
/k6-modules. I’ve validated the files are there by exec’ing to the pod and checking the volume’s content.
output of pod ls
/ # ls k6-modules/v1/
httpd_test.js script_test.js test.main.js test.main.js.map
mount path for the pod used by ci/cd
- mountPath: "/k6-modules"
error i get from my runner
time="2022-08-06T00:16:19Z" level=error msg="The moduleSpecifier \"/test/v1/script_test.js\" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker."
This is my K6 config
arguments: --out statsd
- name: K6_STATSD_ENABLE_TAGS
- name: K6_STATSD_ADDR
Is there anything else i can provide to help debug?
It seems like there might be an issue with the path. As you can see in the error message, k6-operator seeks the JS in
/test folder, i.e.
/test/v1/script_test.js. But it seems like your file is in
/k6-modules instead. Is it possible to move it to
/test ? This is hard-coded at the moment and cannot be changed.
I’ve created an issue to make it less dependent on hard-coded values here but can’t promise when that particular improvement will happen.