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

Add new errext.AbortReason type, move and use old RunStatus type only for k6 cloud code #2810

Merged
merged 2 commits into from
Jan 24, 2023

Commits on Jan 23, 2023

  1. Move the RunStatus type from the lib/ package to cloudapi/

    The run_status constants are something very specific to the k6 cloud, they shouldn't be a part of the main packages.
    na-- committed Jan 23, 2023
    Configuration menu
    Copy the full SHA
    94ca5e0 View commit details
    Browse the repository at this point in the history
  2. Add new AbortReason type, use old RunStatus type only for k6 cloud code

    RunStatus is very specific to the k6 cloud and doesn't map perfectly to how k6 OSS sees the causes of prematurely stopped tests. So, this commit restricts the usage of RunStatus only to the cloudapi/ package and to the `k6 cloud` command handling in `cmd/cloud.go`.
    
    It does that by introducing a new type, `errext.AbortReason`, and a way to attach this type to test run errors. This allows us a cleaner error propagation to the outputs, and every output can map these generic values to its own internal ones however it wants. It is not necessary for that mapping to be exactly 1:1 and, indeed, the `errext.AbortReason`:`cloudapi.RunStatus` mapping in cloudapi/ is not 1:1.
    na-- committed Jan 23, 2023
    Configuration menu
    Copy the full SHA
    2955dcc View commit details
    Browse the repository at this point in the history