I know this might seem like a repeated post/question but it’s not, not really. I have looked and searched the forums as well as K6 documentation and have not found an answer, well at least not an answer that works in my script unless I am using it wrong (which is very likely).
I have Postman requests that I have converted to K6 scripts using the Postman-to-K6 tool. When I run the test doing multiple user requests, I get a time out error when I reach about 25 of 40 users.
The API/webservice itself is not timing out, we have looked at the logs and there are no errors.
While the test is running in K6, I go to Postman and manually run the same request from there as well. It starts off with a response time of about 9 seconds, but then as the users increase on K6 so does the wait time on Postman, up to about 1m45s, Postman still comes back with the response regardless of the wait time but K6 starts showing timeout errors. This leads me to believe that the default K6 timeout is being reached at which point K6 starts throwing the error.
Now I understand that there is a way to up the timeout, it is in the documentation of K6, but when I try to up the timeout it does not work. I cannot find a decent code sample of how exactly this is supposed to be done anywhere, support and other users just seems to refer people back to the K6 documentation which only gives theory and is not very detailed and has no practical samples. I have even used the parameters file when using the Postman-To-K6 conversion tool, it does add the adjusted timeout to the script but that does not allow the script to run, K6 just immediately throws an error, and the run does not even start.
Below is a snippet of my code, the commented-out code (when it was not commented out), and currently active code does not adjust the timeout, the script does however run without error, so the syntax is correct and K6 accepts the parameters, but it seems like K6 does not apply them.
// Auto-generated by the postman-to-k6 converter
import "./libs/shim/core.js";
import http from 'k6/http';
//let params = {timeout: '240s'}; commented out because it did not work.
export let options = { maxRedirects: 4, // timeout: '240s', commented out because it did not work.
stages: [
{ duration: '10s', target: 5 },
{ duration: '5m', target: 40 },
{ duration: '1m', target: 5 },
{ duration: '5m', target: 40 },
{ duration: '10s', target: 0 },
],
thresholds: {
'http_req_duration': ['p(99)<1500'], // 99% of requests must complete below 1.5s
},
};
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
let params = {timeout: '240s'}; // currently active code but still does not work.
postman[Request]({
name: "Track Req Response Limit Reached K6",
id: "sample ID",
method: "POST",