-
Notifications
You must be signed in to change notification settings - Fork 20
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
xk6it integration test runner for extensions #74
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, what's the rationale behind vendoring deps? Is that really needed?
// In practice, the execution corresponds to the "xk6 run script.js" command, | ||
// but the xk6 binary is not necessary, because it uses xk6 as a library. | ||
// In case of any error, t.Error() is called. | ||
func Run(t *testing.T, pattern string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to see an example of how Run
can/should be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few clarification questions I would also like to see an example of how this can be used.
In general, I'm not entirely sure I understand what this change brings to xk6 at the moment, and what it makes possible, and I think an example would be valuable 😸 🙇🏻
) | ||
|
||
// Run builds k6 in temporary location and run scripts matching the given pattern. | ||
// For the given integration script, it searches for the containing go module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is "integration script" referring to here ❓
Also, just for my understanding is that this function is a way to programmatically xk6 run
a xk6 extension, based on the assumption it's structured in a way that it has a dedicated go module (the actual structure is not important, but I just want to double check my understanding 👍🏻):
my_extension/
register.go
go.mod
my_module/
module.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right
Co-authored-by: Théo Crevon <[email protected]>
Here is an example of usage: https://github.com/szkiba/tygor/blob/master/examples/examples_test.go#L25 It is possible that this feature is not yet mature enough, so I may close the PR and reopen it later. |
@szkiba considering the ongoing reorganization of the |
This pr adds xk6it.Run function for extension integration testing support.
xk6it.Run builds k6 in temporary location and run scripts matching the given pattern.
For the given integration script, it searches for the containing go module
and based on that, builds k6 binary for execution.
For a given go module, the k6 build is done only once.
The k6 binary is placed in a temporary directory belonging to the call,
which is automatically deleted by the go test runner at the end of the run.
In practice, the execution corresponds to the
xk6 run script.js
command,but the xk6 binary is not necessary, because it uses xk6 as a library.
In case of any error, t.Error() is called.