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

[1/2] Implement the --local-execution mode for k6 cloud run #3904

Merged
merged 11 commits into from
Sep 10, 2024

Conversation

oleiade
Copy link
Member

@oleiade oleiade commented Aug 21, 2024

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 run flags 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 you k6 cloud run-locally.
  • Related to ☝🏻 we imported the --linger and --no-usage-report options from the k6 run command and made them available/functional only when --local-execution is passed. Do we consider this approach satisfactory?
  • We have overridden the getConfig function to enforce the output to be set to cloud. This is the most straightforward way we found to do this. If you have a better idea, please feel free to suggest 🙇🏻

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

ref #3818
ref #3282

@oleiade oleiade requested a review from a team as a code owner August 21, 2024 08:21
@oleiade oleiade requested review from mstoykov and olegbespalov and removed request for a team August 21, 2024 08:21
@oleiade oleiade requested a review from joanlopez August 21, 2024 08:23
cmd/cloud_run.go Outdated Show resolved Hide resolved
This commits aligns the handling of the --no-usage-report option in the
context of the k6 cloud run command with the following agreed upon
behavior:
* k6 cloud run --no-usage-report should ignore the flag, and make
sure we don't send the report.
* k6 cloud run --local-execution --no-usage-report  should take the
flag in consideration, and act accordingly.
cmd/cloud_run.go Outdated Show resolved Hide resolved
cmd/tests/cmd_cloud_run_test.go Outdated Show resolved Hide resolved
cmd/cloud_run.go Outdated Show resolved Hide resolved
cmd/tests/cmd_cloud_run_test.go Outdated Show resolved Hide resolved
@olegbespalov olegbespalov added the documentation-needed A PR which will need a separate PR for documentation label Sep 3, 2024
@oleiade oleiade changed the title Implement the --local-execution mode for k6 cloud run [1/2] Implement the --local-execution mode for k6 cloud run Sep 4, 2024
olegbespalov
olegbespalov previously approved these changes Sep 9, 2024
cmd/cloud_run.go Outdated Show resolved Hide resolved
joanlopez
joanlopez previously approved these changes Sep 9, 2024
Co-authored-by: Oleg Bespalov <[email protected]>
olegbespalov
olegbespalov previously approved these changes Sep 10, 2024
cmd/cloud_run.go Outdated Show resolved Hide resolved
@oleiade oleiade merged commit 999a614 into master Sep 10, 2024
22 checks passed
@oleiade oleiade deleted the new_cloud_run_local_execution branch September 10, 2024 14:37
@olegbespalov olegbespalov added this to the v0.54.0 milestone Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation-needed A PR which will need a separate PR for documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants