You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Team. We only started to use K6 Operator in our environment. But we have an issue with Initializer, it fails on --execution-requirements if we have in test.js const Users = __ENV.USERS.split(" "); for example. The issue could be fixed if I add --execution-requirements --include-system-env-vars but I don't see possibility of changing Initializer command.
Create test.js file with const Users = __ENV.USERS.split(" ");
export USERS="TEST1 TEST2";
Run k6 inspect --execution-requirements test.js will result in error TypeError: Cannot read property 'split' of undefined or null
Run k6 inspect --execution-requirements --include-system-env-vars test.js result without errors
Expected behaviour
Initializer not fails
Actual behaviour
Initializer fails
The text was updated successfully, but these errors were encountered:
As is described, there is a known discrepancy in how different k6 commands behave. It is not happening at the level of k6-operator. Adding --include-system-env-vars to initializer command means introducing potential security issues. IMHO, it'd be ideal to fix these issues at k6 level: grafana/k6#2744
Closer to your use case, would it work for you to move the logic around Users to setup function instead of init context?
Hello @yorugac,
Thank you very much for your response. For now, we will use the workaround described in internal docs: const Users = __ENV.USERS ? __ENV.USERS.split(" ") : [];
Thanks for the help
This was partially improved in #290. A complete fix for env vars would require solution at k6 level. As for improving initializer further, closing in favor of this issue.
Brief summary
Hello Team. We only started to use K6 Operator in our environment. But we have an issue with Initializer, it fails on --execution-requirements if we have in test.js
const Users = __ENV.USERS.split(" ");
for example. The issue could be fixed if I add--execution-requirements --include-system-env-vars
but I don't see possibility of changing Initializer command.k6-operator version or image
0.0.13
Helm chart version (if applicable)
3.5.0
TestRun / PrivateLoadZone YAML
Other environment details (if applicable)
No response
Steps to reproduce the problem
Create test.js file with const Users = __ENV.USERS.split(" ");
export USERS="TEST1 TEST2";
Run k6 inspect --execution-requirements test.js will result in error TypeError: Cannot read property 'split' of undefined or null
Run k6 inspect --execution-requirements --include-system-env-vars test.js result without errors
Expected behaviour
Initializer not fails
Actual behaviour
Initializer fails
The text was updated successfully, but these errors were encountered: