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

Different exit codes for different errors #870

Closed
na-- opened this issue Dec 14, 2018 · 1 comment
Closed

Different exit codes for different errors #870

na-- opened this issue Dec 14, 2018 · 1 comment
Labels
docs enhancement evaluation needed proposal needs to be validated or tested before fully implementing it in k6 feature ux

Comments

@na--
Copy link
Member

na-- commented Dec 14, 2018

Currently k6 has only a few exit codes we specifically set - 98 and 99:

  • k6 run with a failed threshold will return 99 (code)
  • k6 cloud will fail with 98 if it couldn't get the test progress for some reason (I think) like network failure and with 99 if the test run itself failed (code)

k6 will otherwise exit with 0 if there were no errors or with 255 for anything else that fails in a controlled manner, i.e. anything that's not a panic or OOM (code).

(Go panics could also make k6 exit with a few different exit codes, though we've hopefully mostly eliminated them in k6, this is the only one we've recently seen. Skimming this file, it seems like most of the time exit(2) should be called, but technically it's also possible to have exit(4) and exit(5) when panicking, even if unlikely...)

This issue is a proposition that different types of errors should cause k6 to exit with different error codes. We should reserve a range and define, document and distinguish between errors - config validation errors, script errors in the init phase, script errors in the setup or teardown phases, crossed script errors threshold (will write another issue about that), etc. When we've defined a range for k6 system exit codes, we can also define a range for user error codes and allow users to specify them in the thresholds configurations, as requested in this issue.

These enhancements could be very useful when using k6 in a CI environment.

@oleiade
Copy link
Member

oleiade commented Oct 2, 2023

We believe this has been addressed, and the team agreed to close it. k6 now have specific exit codes, and if more were necessary, please feel free to open specific issues accordingly 🙇🏻

@oleiade oleiade closed this as completed Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs enhancement evaluation needed proposal needs to be validated or tested before fully implementing it in k6 feature ux
Projects
None yet
Development

No branches or pull requests

3 participants