-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User-friendly error when test name is not set in cloud execution #923
Comments
We've fixed this issue at least two times in the past (#214, #510), it's time for a test case 😄 I think we should have a default name when the script comes from stdin (if not we default to the filename), as we've had in the past, and at most warn/inform the user with a friendly message that they can set their own name by setting it in the JS options or using the env var (we can detect it in Insights and hint there as well). |
This also should allow k6 to support xk6 extensions for outputs. And it fixes #923 by setting a default script name if none is specified.
This actually fixes #923 according to what was discussed in the issue.
Cloud execution of tests via
k6 cloud
requires that the test'sname
is set. That can be done via theext.loadimpact.name
property in the script's exportedoptions
(or global JSON config), or via theK6_CLOUD_NAME
environment variable. If none of those values are set, the script filename is used instead.But when passing test scripts via
stdin
(which is very common when using docker:docker run -e K6_CLOUD_TOKEN="<my-cloud-token>" -i loadimpact/k6 cloud - <script.js
), k6 doesn't know the filename, and this results in confusing errors likeUnexpected HTTP error from https://ingest.loadimpact.com/v1/archive-upload: 422 Unprocessable Entity
.We should validate that the script's
name
property is set in k6, before sending the archive bundle to the cloud, and emit a user-friendly error that suggests that users should setK6_CLOUD_NAME
orext.loadimpact.name
The text was updated successfully, but these errors were encountered: