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

Using 'xk6 run --with' should be possible #2

Open
mstoykov opened this issue Nov 30, 2020 · 2 comments
Open

Using 'xk6 run --with' should be possible #2

mstoykov opened this issue Nov 30, 2020 · 2 comments

Comments

@mstoykov
Copy link
Contributor

Currently 'xk6 run --with' will correctly build the binary(including the correct extensions), but then will also send the --with to the k6 which will at that point exit with an error as it doesn't know of such a flag.

@imiric
Copy link
Contributor

imiric commented Dec 1, 2020

Hey, I think this is a docs issue, as it's working as designed. See the plugin development section.

If you run xk6 without build it will build a k6 binary with the extension in the CWD and passthrough any arguments to the parent command (k6 in this case). It's meant to be used as a quick way to test extensions while developing, so I think it's a useful feature. So the run in your example is interpreted by k6, not xk6. :)

One thing to keep in mind is that it will run k6 and not ./k6 (i.e. the executable just built), so if k6 is already in your PATH, it will seem like nothing happened and k6 will complain about a missing module. I think it would be safe to invoke ./k6 and .\k6.exe here instead to avoid the PATH issue: https://github.com/k6io/xk6/blob/master/cmd/xk6/main.go#L140-L145

I'll propose that change in an upcoming PR.

@mstoykov
Copy link
Contributor Author

mstoykov commented Dec 1, 2020

One thing to keep in mind is that it will run k6 and not ./k6 (i.e. the executable just built), so if k6 is already in your PATH, it will seem like nothing happened and k6 will complain about a missing module. I think it would be safe to invoke ./k6 and .\k6.exe here instead to avoid the PATH issue: https://github.com/k6io/xk6/blob/master/cmd/xk6/main.go#L140-L145

Hm I think this is why I decided that I actually need to use the --with ... I guess it will be more correct to build it in a temp dir and use it directly from there ?

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

No branches or pull requests

2 participants