add sleep option for all operations

Signed-off-by: anatoly@nspcc.ru <anatoly@nspcc.ru>
fyrchik/lorem-ipsum
anatoly@nspcc.ru 2022-08-10 14:31:03 +03:00 committed by Anatoly Bogatyrev
parent 3d7d902da4
commit 402d5feb8f
3 changed files with 23 additions and 2 deletions

View File

@ -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() {

View File

@ -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() {

View File

@ -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);
}
}