Skip to content
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

Closed
na-- opened this issue Feb 11, 2019 · 1 comment · Fixed by #1870
Closed

User-friendly error when test name is not set in cloud execution #923

na-- opened this issue Feb 11, 2019 · 1 comment · Fixed by #1870

Comments

@na--
Copy link
Member

na-- commented Feb 11, 2019

Cloud execution of tests via k6 cloud requires that the test's name is set. That can be done via the ext.loadimpact.name property in the script's exported options (or global JSON config), or via the K6_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 like Unexpected 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 set K6_CLOUD_NAME or ext.loadimpact.name

@robingustafsson
Copy link
Member

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).

@na-- na-- added this to the v0.28.0 milestone Jul 16, 2020
@na-- na-- modified the milestones: v0.28.0, v1.0.0 Sep 8, 2020
@na-- na-- self-assigned this Feb 15, 2021
na-- added a commit that referenced this issue Feb 23, 2021
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.
@na-- na-- modified the milestones: v1.0.0, v0.31.0 Feb 23, 2021
na-- added a commit that referenced this issue Feb 23, 2021
This actually fixes #923 according to what was discussed in the issue.
na-- added a commit that referenced this issue Feb 23, 2021
na-- added a commit that referenced this issue Feb 25, 2021
na-- added a commit that referenced this issue Feb 25, 2021
na-- added a commit that referenced this issue Feb 26, 2021
na-- added a commit that referenced this issue Feb 26, 2021
na-- added a commit that referenced this issue Mar 1, 2021
@na-- na-- mentioned this issue Mar 5, 2021
harrytwigg pushed a commit to APITeamLimited/globe-test that referenced this issue Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants