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

Create k6runner.Script and make probers aware of it #727

Merged
merged 2 commits into from
Jun 18, 2024
Merged

Conversation

nadiamoe
Copy link
Member

@nadiamoe nadiamoe commented Jun 11, 2024

Before this PR, MultiHTTP and Scripted Probers created k6 runners using only the raw script data ([]byte) as input to the runner. This have worked nicely, as until now runners only required two things to work: The raw script data, and a timeout that was encoded in the context for Runner.Run().

We have seen however a couple scenarios that make me think this is not enough for the near future:

For these three reasons, I think it is beneficial to create a richer type so that Probers can feed all these details to the k6 runner, which this PR does.

Please note that this PR is not feature complete, namely how timeouts are handled does not fully makes sense. This is because I tried to keep the patchset as small as possible for reviewability. How timeouts are handled is improved in #724.

@nadiamoe nadiamoe requested a review from a team as a code owner June 11, 2024 06:40
type Runner interface {
WithLogger(logger *zerolog.Logger) Runner
Run(ctx context.Context, script []byte) (*RunResponse, error)
Run(ctx context.Context, script Script) (*RunResponse, error)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the core change of this PR: Replace the []byte argument in Runner.Run with the new Script type. All other changes are essentially adapting the rest of the codebase to this change.

@nadiamoe nadiamoe force-pushed the k6-script-type branch 10 times, most recently from 5cb4ee3 to d67cc4e Compare June 11, 2024 10:29
@nadiamoe nadiamoe merged commit 87e4339 into main Jun 18, 2024
4 checks passed
@nadiamoe nadiamoe deleted the k6-script-type branch June 18, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants