My team are evaluating the usage of k6 for our extensive load tests.
Is there an option to start tests and provide file with 100 endpoints and during the test add additional 100 endpoints? im talking about the same test , like hot reload for configurations
As k6 is mostly just running a provided JS script you can have it run one function for some duration and then another for a second duration. I propose that for this purpose you use 2 scenarios and startTime to start the second one a few minutes after the first one. Then you can have the two functions hitting different endpoints for example.
If you want this to be somehow signaled to k6 that now it should start running another code instead of this being predefined, this will be harder. I can’t currently from the top of my head figure out anything that won’t be extremely complicated. If this is what you desire I would recommend trying to go with a custom xk6 extension especially if you don’t intend of using the cloud, as we don’t have support for custom xk6 extensions there ;).
I hope this helps you and ask away if there is something else
I refer to the second option , in nodejs there is option to hot-reload configs etc via node-demon , and in go GitHub - spf13/viper: Go configuration with fangs . do you think we can reuse some of them ?
regard the extension, not sure I got how they can help…
There is definitely no such functionality currently. I am not particularly certain that … config reload is even a thing that I k6 should have at all, but you are welcome to open an issue explaining what you mean by it and maybe even proposing a PR ;).
Currently, the only way for something that might work(that isn’t with scenarios) is to be based on some HTTP/websocket/gRPC response for each VU individually to decide that it should change what it needs to do.
var something = false; // a flag that something has changed
export default function(){
if (something) {
// call some URLs
var resp= http.get(someurl);
if (/*some condition based on this response*/) {
something = true; // switch to other branch
// maybe break/return here
}
// call some more URLs
} else {
// call other URLs
}
}
Hope this example illustrates it better.
regard the extension, not sure I got how they can help…
You can write your own extension so that you can skip the part with making requests but instead checking something internally.