I am doing a batch request for a series of urls and when I do a check I get 0% for my checks but when I change the checks to check[0] I get 100%. Does anyone have an idea what’s going on?
import http from 'k6/http';
import { group, sleep, check } from "k6";
export let options = {
stages: [
{ duration: "30s", target: 50 },
{ duration: "30s", target: 50 },
{ duration: "30s", target: 0 },
],
thresholds: {
'http_req_duration': ['avg < 5000'],
},
};
export default function () {
group(' elasticsearch', function () {
group(':9200', function () {
let responses = http.batch([
['GET', 'http://chartfa.........'],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.2],
['POST', 'http://10.1.11.25],
['POST', 'http://10.1.11.25],
['POST', 'http://10.1.11.25],
['POST', 'http://10.1.11.2],
['POST', 'http://10.1.11.2'],
['GET', 'http://10.1.11.25],
['GET', 'http://10.1.11.25'],
['GET', 'http://10.1.11.25'],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.25,
['POST', 'http://10.1.11.25],
['POST', 'http://10.1.11.25],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.25],
['GET', 'http://10.1.11.254],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.2'],
['POST', 'http://10.1.11.2'],
])
//check repsonses doesn't work
//check responses[0] does work
check(responses, {
'good to go': (r)=> r.status === 200
})
});
})
sleep(1)
}