Add check to tests
This commit is contained in:
parent
03aedd9564
commit
4ac39a2730
4 changed files with 12 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
import http from 'k6/http';
|
||||
import { sleep } from 'k6';
|
||||
import { sleep, check } from 'k6';
|
||||
import { SharedArray } from 'k6/data';
|
||||
|
||||
var hostname = __ENV.HOSTNAME;
|
||||
|
@ -33,6 +33,7 @@ const dates = new SharedArray('dates', function () {
|
|||
|
||||
export default () => {
|
||||
const randomDate = dates[Math.floor(Math.random() * dates.length)];
|
||||
http.get(`http://${hostname}/age/${randomDate}`);
|
||||
const res = http.get(`http://${hostname}/age/${randomDate}`);
|
||||
check(res, { '200': (r) => r.status === 200 });
|
||||
sleep(1);
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
import http from 'k6/http';
|
||||
import { sleep } from 'k6';
|
||||
import { sleep, check } from 'k6';
|
||||
import { SharedArray } from 'k6/data';
|
||||
|
||||
var hostname = __ENV.HOSTNAME;
|
||||
|
@ -30,6 +30,7 @@ const dates = new SharedArray('dates', function () {
|
|||
|
||||
export default () => {
|
||||
const randomDate = dates[Math.floor(Math.random() * dates.length)];
|
||||
http.get(`http://${hostname}/age/${randomDate}`);
|
||||
const res = http.get(`http://${hostname}/age/${randomDate}`);
|
||||
check(res, { '200': (r) => r.status === 200 });
|
||||
sleep(1);
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
import http from 'k6/http';
|
||||
import { sleep } from 'k6';
|
||||
import { sleep, check } from 'k6';
|
||||
import { SharedArray } from 'k6/data';
|
||||
|
||||
var hostname = __ENV.HOSTNAME;
|
||||
|
@ -34,6 +34,7 @@ const dates = new SharedArray('dates', function () {
|
|||
|
||||
export default () => {
|
||||
const randomDate = dates[Math.floor(Math.random() * dates.length)];
|
||||
http.get(`http://${hostname}/age/${randomDate}`);
|
||||
const res = http.get(`http://${hostname}/age/${randomDate}`);
|
||||
check(res, { '200': (r) => r.status === 200 });
|
||||
sleep(1);
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
import http from 'k6/http';
|
||||
import { sleep } from 'k6';
|
||||
import { sleep, check } from 'k6';
|
||||
import { SharedArray } from 'k6/data';
|
||||
|
||||
var hostname = __ENV.HOSTNAME;
|
||||
|
@ -34,6 +34,7 @@ const dates = new SharedArray('dates', function () {
|
|||
|
||||
export default () => {
|
||||
const randomDate = dates[Math.floor(Math.random() * dates.length)];
|
||||
http.get(`http://${hostname}/age/${randomDate}`);
|
||||
const res = http.get(`http://${hostname}/age/${randomDate}`);
|
||||
check(res, { '200': (r) => r.status === 200 });
|
||||
sleep(1);
|
||||
};
|
Loading…
Reference in a new issue