k6
k6 copied to clipboard
Implement the --local-execution mode for k6 cloud run
What?
This PR adds support for a new --local-execution flag to the k6 cloud run command. Using it, users can run their test script or archive on their local machine while streaming the results to the cloud.
In the context of this PR, the goal is to reproduce the behavior of the k6 run -o cloud behavior; we will add support for archive upload, logs, and trace forwarding in future PRs.
Considerations and open questions
- During the implementation, we realized with @joanlopez that having a dedicated subcommand, as opposed to a flag, could lead to a more compartimatenlized flag structure, and clearer inter-dependencies between them: with this PR some
k6 cloud runflags are now only allowed/relevant in conjunction with--local-execution. However, after brainstorming, we couldn't find a satisfactory name, that wouldn't feel weird and confusing (I'm looking at youk6 cloud run-locally. - Related to ☝🏻 we imported the
--lingerand--no-usage-reportoptions from thek6 runcommand and made them available/functional only when--local-executionis passed. Do we consider this approach satisfactory? - We have overridden the
getConfigfunction to enforce the output to be set tocloud. This is the most straightforward way we found to do this. If you have a better idea, please feel free to suggest 🙇🏻
Checklist
- [X] I have performed a self-review of my code.
- [X] I have added tests for my changes.
- [X] I have run linter locally (
make lint) and all checks pass. - [X] I have run tests locally (
make tests) and all tests pass. - [X] I have commented on my code, particularly in hard-to-understand areas.
Related PR(s)/Issue(s)
ref #3818 ref #3282