-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
k6/execution
: add more information about the current test run
#2259
Comments
Just a note so that we don't make the same mistake from #1320: let's avoid suggesting features for the |
If you look at the old issue, a lot (most?) of these actually came from user requests. But yeah, in general, I agree and this is not a very high priority issue as of now. I'd appreciate any users to comment with their specific use cases here, that will help with us prioritizing it more highly. |
Regarding a "the current working directory and file name" use case: providing the The obvious workaround to not having access to the script name programmatically is to simply hardcode it, so generally speaking, I see it as low priority. Querying the |
we need this to track usage of our 30-something load test scripts in order to identify unused ones and highly important ones. |
@geekflyer As a workaround, could you set the filename in an environment variable and read it from the script? For example: // /tmp/test.js
export default function() {
console.log('Script filename:', __ENV.FILENAME);
} $ export FILENAME=/tmp/test.js
$ k6 run "$FILENAME"
[...]
INFO[0000] Script filename: /tmp/test.js source=console |
Hey all- I have a use case for this where I need to ensure that people contributing to tests are naming scenarios in a specific way. If it was possible to get the filename, I could set the scenario for them. Is this still on the roadmap? |
I also really want to be able to identify the name of the current file. My test suite has grown fairly large and being able to do this would make it a lot easier to tie test scripts to configurations in a big YAML file. |
This is a continuation of some of the things mentioned in #1320 that relate to information about the currently running test, but which were not implemented in the original
k6/execution
API that shipped in k6 v0.34.0.#2093 adds a new
k6/execution.test.abort()
method, but we currently don't expose any of the information about the current test run in it. Some potentially useful things we could add expose there:options
? this seems cleaner than relying on the fact that we'll update the exported scriptoptions
, and we've had a bunch of issues with that (see fix setting js options on the wrong object #1430)...__ENV
...k6/execution.instance
...Some of these things will probably be useful in the init context as well (e.g. the CWD and env vars), so parts of
k6/execution.test
should definitely be accessible from the init context. Some parts, like the consolidatedoptions
or total test run duration, can't be available in the first init context execution (because it is the thing that actually gets the exportedoptions
...), but would be quite useful in subsequent VU initializations...The text was updated successfully, but these errors were encountered: