I’m having a hard time defining the duration of a test, it always shows maxDuration of 10m.
I use the following code to define the k6 options, but for some reason the duration and scenarios don’t take effect:
export const options = {
duration: "60s",
scenarios: {
s1: {
executor: "per-vu-iterations",
gracefulStop: "0s",
maxDuration: "80s",
},
},
insecureSkipTLSVerify: true,
thresholds: {
"checks{myTag: authenticate}": ["rate==1.0"],
"checks{myTag: book-update}": ["rate>=0.9"],
"checks{myTag: historical-orders}": ["rate==1.0"],
"checks{myTag: historical-partials}": ["rate==1.0"],
"checks{myTag: historical-shadow}": ["rate==1.0"],
"checks{myTag: historical-viewers}": ["rate==1.0"],
"checks{myTag: login}": ["rate==1.0"],
"checks{myTag: today-orders}": ["rate==1.0"],
"checks{myTag: today-shadow}": ["rate==1.0"],
"checks{myTag: user-settings}": ["rate==1.0"],
"checks{myTag: user-widgets}": ["rate==1.0"],
"checks{myTag: user-information}": ["rate==1.0"],
"checks{myTag: ws_auth}": ["rate==1.0"],
"checks{myTag: ws connect}": ["rate==1.0"],
},
};
...
export default function () {
console.log(JSON.stringify(exec.test.options));
console.log(JSON.stringify(options));
}
The output is as follows:
execution: local
script: k6_test/ws_v1.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations shared among 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0002] {"paused":null,"scenarios":{"default":{"executor":"shared-iterations","startTime":null,"gracefulStop":null,"env":null,"exec":null,"tags":null,"vus":1,"iterations":1,"maxDuration":null}},"executionSegment":null,"executionSegmentSequence":null,"noSetup":null,"setupTimeout":null,"noTeardown":null,"teardownTimeout":null,"rps":null,"dns":{"ttl":null,"select":null,"policy":null},"maxRedirects":null,"userAgent":null,"batch":null,"batchPerHost":null,"httpDebug":null,"insecureSkipTLSVerify":true,"tlsCipherSuites":null,"tlsVersion":null,"tlsAuth":null,"throw":null,"thresholds":{"checks{myTag: authenticate}":["rate==1.0"],"checks{myTag: book-update}":["rate>=0.9"],"checks{myTag: historical-orders}":["rate==1.0"],"checks{myTag: historical-partials}":["rate==1.0"],"checks{myTag: historical-shadow}":["rate==1.0"],"checks{myTag: historical-viewers}":["rate==1.0"],"checks{myTag: login}":["rate==1.0"],"checks{myTag: today-orders}":["rate==1.0"],"checks{myTag: today-shadow}":["rate==1.0"],"checks{myTag: user-information}":["rate==1.0"],"checks{myTag: user-settings}":["rate==1.0"],"checks{myTag: user-widgets}":["rate==1.0"],"checks{myTag: ws connect}":["rate==1.0"],"checks{myTag: ws_auth}":["rate==1.0"]},"blacklistIPs":null,"blockHostnames":null,"hosts":null,"noConnectionReuse":null,"noVUConnectionReuse":null,"minIterationDuration":null,"ext":null,"summaryTrendStats":["avg","min","med","max","p(90)","p(95)"],"summaryTimeUnit":null,"systemTags":["check","error","error_code","expected_response","group","method","name","proto","scenario","service","status","subproto","tls_version","url"],"tags":null,"metricSamplesBufferSize":null,"noCookiesReset":null,"discardResponseBodies":null,"consoleOutput":null,"localIPs":null} source=console
INFO[0002] {"duration":"60s","scenarios":{},"insecureSkipTLSVerify":true,"thresholds":{"checks{myTag: today-orders}":["rate==1.0"],"checks{myTag: user-settings}":["rate==1.0"],"checks{myTag: user-widgets}":["rate==1.0"],"checks{myTag: ws connect}":["rate==1.0"],"checks{myTag: login}":["rate==1.0"],"checks{myTag: today-shadow}":["rate==1.0"],"checks{myTag: authenticate}":["rate==1.0"],"checks{myTag: book-update}":["rate>=0.9"],"checks{myTag: historical-orders}":["rate==1.0"],"checks{myTag: historical-viewers}":["rate==1.0"],"checks{myTag: user-information}":["rate==1.0"],"checks{myTag: historical-partials}":["rate==1.0"],"checks{myTag: historical-shadow}":["rate==1.0"],"checks{myTag: ws_auth}":["rate==1.0"]},"vus":1,"iterations":1,"summaryTrendStats":["avg","min","med","max","p(90)","p(95)"],"systemTags":["check","error","error_code","expected_response","group","method","name","proto","scenario","service","status","subproto","tls_version","url"]} source=console
Note that the scenarios object is empty in options even though it has been assigned, so it appears to have been modified during k6 execution. It is also a different value in exec.test.options than what was assigned.
Other than passing –duration from CLI, how can I set these duration options?