Hi all,
not a problem per se but trying to get my head around an execution question.
I am reading config from a json file written by jenkins so the order is not always guaranteed.
sample json
[{"key":"duration","value":"30m"},{"key":"rampdown","value":"30s"},{"key":"rampup","value":"300s"}]
So I wrote some code to loop through the json and then display the variables to console.
sample code:
const testConfig = JSON.parse(open('./testfile.json'));
for (const property in testConfig) {
var key = testConfig[property].key;
console.log("\tkey: " + key);
switch (key) {
case
"duration":
var duration = testConfig[property].value;
break;
case
"rampup":
var rampup = testConfig[property].value;
break;
case
"rampdown":
var rampdown = testConfig[property].value;
break;
}
}
console.log(`${rampup}, ${duration},${rampdown}`);
export default function () {
console.log("starting...");
}
I’d expect to see the property displayed, then the variables then a starting message, what i get is:
k6 run .\perf_k6_sample.js
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
INFO[0000] key: duration source=console
INFO[0000] key: rampdown source=console
INFO[0000] key: rampup source=console
INFO[0000] 300s, 30m,30s source=console
execution: local
script: .\perf_k6_sample.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0000] key: duration source=console
INFO[0000] key: rampdown source=console
INFO[0000] key: rampup source=console
INFO[0000] 300s, 30m,30s source=console
INFO[0000] key: duration source=console
INFO[0000] key: rampdown source=console
INFO[0000] key: rampup source=console
INFO[0000] 300s, 30m,30s source=console
INFO[0000] starting... source=console
INFO[0000] key: duration source=console
INFO[0000] key: rampdown source=console
INFO[0000] key: rampup source=console
INFO[0000] 300s, 30m,30s source=console
running (00m00.2s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.0s/10m0s 1/1 iters, 1 per VU
INFO[0000] key: duration source=console
INFO[0000] key: rampdown source=console
INFO[0000] key: rampup source=console
INFO[0000] 300s, 30m,30s source=console
data_received........: 0 B 0 B/s
data_sent............: 0 B 0 B/s
iteration_duration...: avg=4.6ms min=4.6ms med=4.6ms max=4.6ms p(90)=4.6ms p(95)=4.6ms
iterations...........: 1 4.661324/s
Not sure if this is an issue or not but if I was running at high load it could well be?