-
Notifications
You must be signed in to change notification settings - Fork 41
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
xk6-browser should be importable as a k6 module #667
Conversation
Moves the module registration logic to a new pkg called browser.
1d59256
to
22956cf
Compare
22956cf
to
35f8dac
Compare
This change made to be consistent. As it used like so in other modules.
35f8dac
to
4a01306
Compare
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.
LGTM. Thanks for making it consistent with the other experimental modules 👍
I think we should get approval from the k6 team too.
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.
LGTM!
I have left some comments that are likely mostly for openning new issues or taking notes.
|
||
// TestModuleNew tests registering the module. | ||
// It doesn't test the module's remaining functionality as it is | ||
// already tested in the tests/ integration tests. |
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.
Shall the tests
then just import browser
and test it ?
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.
preferably not in this PR but later ;)
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.
That makes sense, thanks :) However, I liked keeping this simple test next to the module registration. So that it would be easier to make changes to both code and tests when needed (instead of jumping to the other parts of the code base (tests/
).
) | ||
|
||
func init() { | ||
if _, ok := os.LookupEnv("K6_BROWSER_PPROF"); ok { |
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 guess we should remember that this won't work with core k6.
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.
That's fine tbh.
Out of curiosity, why wouldn't the init
function run when k6
imports the module? I thought that all init
functions had to to run (which is an unwanted side affect sometimes).
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 import a package.
And we are not going to import this package as that will also register the extension as k6/x/browser
- the init below this one.
Which is like the whole point of this PR ;)
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.
Aha, yep, of course 🙂
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.
We use this code in our own instances for testing, so that won't be a problem. Thanks for letting us know, though 👍
Closes #662