Hi,
My k6 test script uses a rather long list of domains and picks in it at random.
This list is in a file which should be colocated to the script.
How to achieve this with a custom resource? The script is (following the documentation example) in a config map under ‘script’ – which is not suitable for the data file.
I assume you are using the k6 operator and your dataset is too large for the config map? If not could you expand on what you mean by unsuitable for the data file.
What you could do is build an image from the default runner image and copy in the dataset. You can then reference this image in spec.runner.image in the K6 custom resource.
Actually, there was no issue of size… My ‘unsuitable’ only came from errors about the syntax of the data file not matching the ‘script’ expectation, as it was added to the same configmap:
msg="could not initialize '/test/opendns-top-domains.txt':
could not load JS test 'file:///test/opendns-top-domains.txt':
SyntaxError: file:///test/opendns-top-domains.txt:
Identifier directly after number (18:1)
I can try the spec.runner structure… but at least this fails:
error: error validating "/home/mgirod@azdsthq.net/git/titanhq/dev/cat/vade/k6/custom-resource.yml": error validating data: ValidationError(K6.spec.runner): unknown field "file" in io.k6.v1alpha1.K6.spec.runner; if you choose to ignore these errors, turn validation off with --validate=false
script:
configMap:
file: script.js
name: load-test-data
# both files in the configmap will get mounted in the runner pods at /test
# K6.spec.script.configMap.file specifies the JS entrypoint to the runner