diff --git a/scenarios/grpc.js b/scenarios/grpc.js index 94f299f..11b8615 100644 --- a/scenarios/grpc.js +++ b/scenarios/grpc.js @@ -1,6 +1,7 @@ import native from 'k6/x/neofs/native'; import crypto from 'k6/crypto'; import { SharedArray } from 'k6/data'; +import { sleep } from 'k6'; const obj_list = new SharedArray('obj_list', function () { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; }); @@ -75,6 +76,10 @@ export function obj_write() { if (!resp.success) { console.log(resp.error); } + if (__ENV.SLEEP) { + sleep(__ENV.SLEEP); + } + } export function obj_read() { @@ -83,6 +88,9 @@ export function obj_read() { if (!resp.success) { console.log(resp.error); } + if (__ENV.SLEEP) { + sleep(__ENV.SLEEP); + } } export function uuidv4() { diff --git a/scenarios/http.js b/scenarios/http.js index a79c8fb..bcd1ec8 100644 --- a/scenarios/http.js +++ b/scenarios/http.js @@ -73,7 +73,9 @@ export function obj_write() { if (resp.status != 200) { console.log(`${resp.status}`); } - //sleep(1) + if (__ENV.SLEEP) { + sleep(__ENV.SLEEP); + } } export function obj_read() { @@ -82,6 +84,9 @@ export function obj_read() { if (resp.status != 200) { console.log(`${random_read_obj.object} - ${resp.status}`); } + if (__ENV.SLEEP) { + sleep(__ENV.SLEEP); + } } export function uuidv4() { diff --git a/scenarios/s3.js b/scenarios/s3.js index 1178861..f0ad09c 100644 --- a/scenarios/s3.js +++ b/scenarios/s3.js @@ -1,6 +1,7 @@ import s3 from 'k6/x/neofs/s3'; import crypto from 'k6/crypto'; import { SharedArray } from 'k6/data'; +import { sleep } from 'k6'; const obj_list = new SharedArray('obj_list', function () { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; }); @@ -83,6 +84,10 @@ export function obj_write() { if (!resp.success) { console.log(resp.error); } + + if (__ENV.SLEEP) { + sleep(__ENV.SLEEP); + } } @@ -93,7 +98,10 @@ export function obj_read() { if (!resp.success) { console.log(resp.error); } - + + if (__ENV.SLEEP) { + sleep(__ENV.SLEEP); + } }