[#154] scenarios: Format js files with clang formatter
All checks were successful
DCO action / DCO (pull_request) Successful in 1m4s
Tests and linters / Tests (1.21) (pull_request) Successful in 2m8s
Tests and linters / Tests (1.22) (pull_request) Successful in 2m38s
Tests and linters / Lint (pull_request) Successful in 4m6s
Tests and linters / Tests with -race (pull_request) Successful in 2m52s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m4s
Tests and linters / Tests (1.21) (pull_request) Successful in 2m8s
Tests and linters / Tests (1.22) (pull_request) Successful in 2m38s
Tests and linters / Lint (pull_request) Successful in 4m6s
Tests and linters / Tests with -race (pull_request) Successful in 2m52s
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
4ec75a1c89
commit
5f20d5d88a
6 changed files with 337 additions and 326 deletions
|
@ -1,25 +1,25 @@
|
|||
import { sleep } from 'k6';
|
||||
import { SharedArray } from 'k6/data';
|
||||
import {sleep} from 'k6';
|
||||
import {SharedArray} from 'k6/data';
|
||||
import exec from 'k6/execution';
|
||||
import logging from 'k6/x/frostfs/logging';
|
||||
import native from 'k6/x/frostfs/native';
|
||||
import registry from 'k6/x/frostfs/registry';
|
||||
import stats from 'k6/x/frostfs/stats';
|
||||
|
||||
import { newGenerator } from './libs/datagen.js';
|
||||
import { parseEnv } from './libs/env-parser.js';
|
||||
import { textSummary } from './libs/k6-summary-0.0.2.js';
|
||||
import { uuidv4 } from './libs/k6-utils-1.4.0.js';
|
||||
import {newGenerator} from './libs/datagen.js';
|
||||
import {parseEnv} from './libs/env-parser.js';
|
||||
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||
import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function () { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const container_list = new SharedArray(
|
||||
'container_list',
|
||||
function () { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
@ -31,7 +31,8 @@ const grpc_endpoint =
|
|||
const grpc_client = native.connect(
|
||||
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
||||
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 60,
|
||||
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true' : false,
|
||||
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true'
|
||||
: false,
|
||||
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
||||
const log = logging.new().withField('endpoint', grpc_endpoint);
|
||||
|
||||
|
@ -51,8 +52,8 @@ if (registry_enabled) {
|
|||
obj_to_read_selector = registry.getLoopedSelector(
|
||||
__ENV.REGISTRY_FILE, 'obj_to_read',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status: 'created',
|
||||
age: read_age,
|
||||
status : 'created',
|
||||
age : read_age,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -63,11 +64,11 @@ const write_grpc_chunk_size = 1024 * parseInt(__ENV.GRPC_CHUNK_SIZE || '0')
|
|||
const generator = newGenerator(write_vu_count > 0);
|
||||
if (write_vu_count > 0) {
|
||||
scenarios.write = {
|
||||
executor: 'constant-vus',
|
||||
vus: write_vu_count,
|
||||
duration: `${duration}s`,
|
||||
exec: 'obj_write',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-vus',
|
||||
vus : write_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_write',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -83,19 +84,19 @@ if (registry_enabled && delete_age) {
|
|||
obj_to_delete_selector =
|
||||
constructor(__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status: 'created',
|
||||
age: delete_age,
|
||||
status : 'created',
|
||||
age : delete_age,
|
||||
});
|
||||
}
|
||||
|
||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||
if (read_vu_count > 0) {
|
||||
scenarios.read = {
|
||||
executor: 'constant-vus',
|
||||
vus: read_vu_count,
|
||||
duration: `${duration}s`,
|
||||
exec: 'obj_read',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-vus',
|
||||
vus : read_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_read',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -107,17 +108,17 @@ if (delete_vu_count > 0) {
|
|||
}
|
||||
|
||||
scenarios.delete = {
|
||||
executor: 'constant-vus',
|
||||
vus: delete_vu_count,
|
||||
duration: `${duration}s`,
|
||||
exec: 'obj_delete',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-vus',
|
||||
vus : delete_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_delete',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
export const options = {
|
||||
scenarios,
|
||||
setupTimeout: '5s',
|
||||
setupTimeout : '5s',
|
||||
};
|
||||
|
||||
export function setup() {
|
||||
|
@ -147,8 +148,8 @@ export function teardown(data) {
|
|||
|
||||
export function handleSummary(data) {
|
||||
return {
|
||||
'stdout': textSummary(data, { indent: ' ', enableColors: false }),
|
||||
[summary_json]: JSON.stringify(data),
|
||||
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||
[summary_json] : JSON.stringify(data),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -157,7 +158,7 @@ export function obj_write() {
|
|||
sleep(__ENV.SLEEP_WRITE);
|
||||
}
|
||||
|
||||
const headers = { unique_header: uuidv4() };
|
||||
const headers = {unique_header : uuidv4()};
|
||||
const container =
|
||||
container_list[Math.floor(Math.random() * container_list.length)];
|
||||
|
||||
|
@ -186,7 +187,7 @@ export function obj_read() {
|
|||
}
|
||||
const resp = grpc_client.get(obj.c_id, obj.o_id)
|
||||
if (!resp.success) {
|
||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
||||
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -194,7 +195,7 @@ export function obj_read() {
|
|||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||
const resp = grpc_client.get(obj.container, obj.object)
|
||||
if (!resp.success) {
|
||||
log.withFields({ cid: obj.container, oid: obj.object }).error(resp.error);
|
||||
log.withFields({cid : obj.container, oid : obj.object}).error(resp.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +215,8 @@ export function obj_delete() {
|
|||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
||||
if (!resp.success) {
|
||||
// Log errors except (2052 - object already deleted)
|
||||
log.withFields({ cid: obj.c_id, oid: obj.o_id, op : 'DELETE' }).error(resp.error);
|
||||
log.withFields({cid : obj.c_id, oid : obj.o_id, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
return;
|
||||
}
|
||||
obj_registry.deleteObject(obj.id);
|
||||
|
@ -224,6 +226,7 @@ export function obj_delete() {
|
|||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||
const resp = grpc_client.delete(obj.container, obj.object)
|
||||
if (!resp.success) {
|
||||
log.withFields({ cid: obj.container, oid: obj.object, op : 'DELETE' }).error(resp.error);
|
||||
log.withFields({cid : obj.container, oid : obj.object, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
import { sleep } from 'k6';
|
||||
import { SharedArray } from 'k6/data';
|
||||
import {sleep} from 'k6';
|
||||
import {SharedArray} from 'k6/data';
|
||||
import logging from 'k6/x/frostfs/logging';
|
||||
import native from 'k6/x/frostfs/native';
|
||||
import registry from 'k6/x/frostfs/registry';
|
||||
import stats from 'k6/x/frostfs/stats';
|
||||
|
||||
import { newGenerator } from './libs/datagen.js';
|
||||
import { parseEnv } from './libs/env-parser.js';
|
||||
import { textSummary } from './libs/k6-summary-0.0.2.js';
|
||||
import { uuidv4 } from './libs/k6-utils-1.4.0.js';
|
||||
import {newGenerator} from './libs/datagen.js';
|
||||
import {parseEnv} from './libs/env-parser.js';
|
||||
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||
import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function () {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const container_list = new SharedArray('container_list', function () {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
||||
});
|
||||
const container_list = new SharedArray(
|
||||
'container_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
@ -30,7 +30,8 @@ const grpc_endpoint =
|
|||
const grpc_client = native.connect(
|
||||
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
||||
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 60,
|
||||
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true' : false,
|
||||
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true'
|
||||
: false,
|
||||
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
||||
const log = logging.new().withField('endpoint', grpc_endpoint);
|
||||
|
||||
|
@ -50,8 +51,8 @@ if (registry_enabled && delete_age) {
|
|||
obj_to_delete_selector = registry.getSelector(
|
||||
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status: 'created',
|
||||
age: delete_age,
|
||||
status : 'created',
|
||||
age : delete_age,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,8 +62,8 @@ if (registry_enabled) {
|
|||
obj_to_read_selector = registry.getLoopedSelector(
|
||||
__ENV.REGISTRY_FILE, 'obj_to_read',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status: 'created',
|
||||
age: read_age,
|
||||
status : 'created',
|
||||
age : read_age,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -76,14 +77,14 @@ const write_grpc_chunk_size = 1024 * parseInt(__ENV.GRPC_CHUNK_SIZE || '0')
|
|||
const generator = newGenerator(write_rate > 0);
|
||||
if (write_rate > 0) {
|
||||
scenarios.write = {
|
||||
executor: 'constant-arrival-rate',
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: pre_alloc_write_vus,
|
||||
maxVUs: max_write_vus,
|
||||
rate: write_rate,
|
||||
timeUnit: time_unit,
|
||||
exec: 'obj_write',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-arrival-rate',
|
||||
duration : `${duration}s`,
|
||||
preAllocatedVUs : pre_alloc_write_vus,
|
||||
maxVUs : max_write_vus,
|
||||
rate : write_rate,
|
||||
timeUnit : time_unit,
|
||||
exec : 'obj_write',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -92,14 +93,14 @@ const max_read_vus = parseInt(__ENV.MAX_READERS || pre_alloc_read_vus);
|
|||
const read_rate = parseInt(__ENV.READ_RATE || '0');
|
||||
if (read_rate > 0) {
|
||||
scenarios.read = {
|
||||
executor: 'constant-arrival-rate',
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: pre_alloc_write_vus,
|
||||
maxVUs: max_read_vus,
|
||||
rate: read_rate,
|
||||
timeUnit: time_unit,
|
||||
exec: 'obj_read',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-arrival-rate',
|
||||
duration : `${duration}s`,
|
||||
preAllocatedVUs : pre_alloc_write_vus,
|
||||
maxVUs : max_read_vus,
|
||||
rate : read_rate,
|
||||
timeUnit : time_unit,
|
||||
exec : 'obj_read',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -113,20 +114,20 @@ if (delete_rate > 0) {
|
|||
}
|
||||
|
||||
scenarios.delete = {
|
||||
executor: 'constant-arrival-rate',
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: pre_alloc_delete_vus,
|
||||
maxVUs: max_delete_vus,
|
||||
rate: delete_rate,
|
||||
timeUnit: time_unit,
|
||||
exec: 'obj_delete',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-arrival-rate',
|
||||
duration : `${duration}s`,
|
||||
preAllocatedVUs : pre_alloc_delete_vus,
|
||||
maxVUs : max_delete_vus,
|
||||
rate : delete_rate,
|
||||
timeUnit : time_unit,
|
||||
exec : 'obj_delete',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
export const options = {
|
||||
scenarios,
|
||||
setupTimeout: '5s',
|
||||
setupTimeout : '5s',
|
||||
};
|
||||
|
||||
export function setup() {
|
||||
|
@ -166,8 +167,8 @@ export function teardown(data) {
|
|||
|
||||
export function handleSummary(data) {
|
||||
return {
|
||||
'stdout': textSummary(data, { indent: ' ', enableColors: false }),
|
||||
[summary_json]: JSON.stringify(data),
|
||||
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||
[summary_json] : JSON.stringify(data),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ export function obj_write() {
|
|||
sleep(__ENV.SLEEP_WRITE);
|
||||
}
|
||||
|
||||
const headers = { unique_header: uuidv4() };
|
||||
const headers = {unique_header : uuidv4()};
|
||||
const container =
|
||||
container_list[Math.floor(Math.random() * container_list.length)];
|
||||
|
||||
|
@ -205,7 +206,7 @@ export function obj_read() {
|
|||
}
|
||||
const resp = grpc_client.get(obj.c_id, obj.o_id)
|
||||
if (!resp.success) {
|
||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
||||
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -213,7 +214,7 @@ export function obj_read() {
|
|||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||
const resp = grpc_client.get(obj.container, obj.object)
|
||||
if (!resp.success) {
|
||||
log.withFields({ cid: obj.container, oid: obj.object }).error(resp.error);
|
||||
log.withFields({cid : obj.container, oid : obj.object}).error(resp.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +232,8 @@ export function obj_delete() {
|
|||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
||||
if (!resp.success) {
|
||||
// Log errors except (2052 - object already deleted)
|
||||
log.withFields({ cid: obj.c_id, oid: obj.o_id, op : 'DELETE' }).error(resp.error);
|
||||
log.withFields({cid : obj.c_id, oid : obj.o_id, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -242,6 +244,7 @@ export function obj_delete() {
|
|||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||
const resp = grpc_client.delete(obj.container, obj.object)
|
||||
if (!resp.success) {
|
||||
log.withFields({ cid: obj.container, oid: obj.object, op : 'DELETE' }).error(resp.error);
|
||||
log.withFields({cid : obj.container, oid : obj.object, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
|||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const container_list = new SharedArray('container_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
||||
});
|
||||
const container_list = new SharedArray(
|
||||
'container_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
@ -31,7 +31,7 @@ const max_total_size_gb =
|
|||
const local_client =
|
||||
local.connect(config_file, config_dir, '', debug_logger, max_total_size_gb);
|
||||
const log = logging.new().withFields(
|
||||
{'config_file': config_file, 'config_dir': config_dir});
|
||||
{'config_file' : config_file, 'config_dir' : config_dir});
|
||||
|
||||
const registry_enabled = !!__ENV.REGISTRY_FILE;
|
||||
const obj_registry =
|
||||
|
@ -49,8 +49,8 @@ if (registry_enabled && delete_age) {
|
|||
obj_to_delete_selector = registry.getSelector(
|
||||
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status: 'created',
|
||||
age: delete_age,
|
||||
status : 'created',
|
||||
age : delete_age,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -60,22 +60,22 @@ const write_vu_count = parseInt(__ENV.WRITERS || '0');
|
|||
const generator = newGenerator(write_vu_count > 0);
|
||||
if (write_vu_count > 0) {
|
||||
scenarios.write = {
|
||||
executor: 'constant-vus',
|
||||
vus: write_vu_count,
|
||||
duration: `${duration}s`,
|
||||
exec: 'obj_write',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-vus',
|
||||
vus : write_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_write',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||
if (read_vu_count > 0) {
|
||||
scenarios.read = {
|
||||
executor: 'constant-vus',
|
||||
vus: read_vu_count,
|
||||
duration: `${duration}s`,
|
||||
exec: 'obj_read',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-vus',
|
||||
vus : read_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_read',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -87,17 +87,17 @@ if (delete_vu_count > 0) {
|
|||
}
|
||||
|
||||
scenarios.delete = {
|
||||
executor: 'constant-vus',
|
||||
vus: delete_vu_count,
|
||||
duration: `${duration}s`,
|
||||
exec: 'obj_delete',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-vus',
|
||||
vus : delete_vu_count,
|
||||
duration : `${duration}s`,
|
||||
exec : 'obj_delete',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
export const options = {
|
||||
scenarios,
|
||||
setupTimeout: '5s',
|
||||
setupTimeout : '5s',
|
||||
};
|
||||
|
||||
export function setup() {
|
||||
|
@ -127,13 +127,13 @@ export function teardown(data) {
|
|||
|
||||
export function handleSummary(data) {
|
||||
return {
|
||||
'stdout': textSummary(data, {indent: ' ', enableColors: false}),
|
||||
[summary_json]: JSON.stringify(data),
|
||||
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||
[summary_json] : JSON.stringify(data),
|
||||
};
|
||||
}
|
||||
|
||||
export function obj_write() {
|
||||
const headers = {unique_header: uuidv4()};
|
||||
const headers = {unique_header : uuidv4()};
|
||||
const container =
|
||||
container_list[Math.floor(Math.random() * container_list.length)];
|
||||
|
||||
|
@ -156,7 +156,7 @@ export function obj_read() {
|
|||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||
const resp = local_client.get(obj.container, obj.object)
|
||||
if (!resp.success) {
|
||||
log.withFields({cid: obj.container, oid: obj.object}).error(resp.error);
|
||||
log.withFields({cid : obj.container, oid : obj.object}).error(resp.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ export function obj_delete() {
|
|||
const resp = local_client.delete(obj.c_id, obj.o_id);
|
||||
if (!resp.success) {
|
||||
// Log errors except (2052 - object already deleted)
|
||||
log.withFields({cid: obj.c_id, oid: obj.o_id}).error(resp.error);
|
||||
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ export function obj_delete() {
|
|||
|
||||
const resp = s3_client.delete(obj.bucket, obj.object);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : obj.bucket, key : obj.object, op : 'DELETE'}).error(resp.error);
|
||||
log.withFields({bucket : obj.bucket, key : obj.object, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
|||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const bucket_list = new SharedArray('bucket_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).buckets;
|
||||
});
|
||||
const bucket_list = new SharedArray(
|
||||
'bucket_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).buckets; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
@ -29,7 +29,7 @@ const s3_endpoint =
|
|||
s3_endpoints[Math.floor(Math.random() * s3_endpoints.length)];
|
||||
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
||||
const connection_args = {
|
||||
no_verify_ssl: no_verify_ssl
|
||||
no_verify_ssl : no_verify_ssl
|
||||
};
|
||||
const s3_client = s3.connect(s3_endpoint, connection_args);
|
||||
const log = logging.new().withField('endpoint', s3_endpoint);
|
||||
|
@ -50,8 +50,8 @@ if (registry_enabled && delete_age) {
|
|||
obj_to_delete_selector = registry.getSelector(
|
||||
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status: 'created',
|
||||
age: delete_age,
|
||||
status : 'created',
|
||||
age : delete_age,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,8 @@ if (registry_enabled) {
|
|||
obj_to_read_selector = registry.getLoopedSelector(
|
||||
__ENV.REGISTRY_FILE, 'obj_to_read',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status: 'created',
|
||||
age: read_age,
|
||||
status : 'created',
|
||||
age : read_age,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -75,35 +75,33 @@ const write_rate = parseInt(__ENV.WRITE_RATE || '0');
|
|||
const generator = newGenerator(write_rate > 0);
|
||||
if (write_rate > 0) {
|
||||
scenarios.write = {
|
||||
executor: 'constant-arrival-rate',
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: pre_alloc_write_vus,
|
||||
maxVUs: max_write_vus,
|
||||
rate: write_rate,
|
||||
timeUnit: time_unit,
|
||||
exec: 'obj_write',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-arrival-rate',
|
||||
duration : `${duration}s`,
|
||||
preAllocatedVUs : pre_alloc_write_vus,
|
||||
maxVUs : max_write_vus,
|
||||
rate : write_rate,
|
||||
timeUnit : time_unit,
|
||||
exec : 'obj_write',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
const pre_alloc_read_vus = parseInt(__ENV.PRE_ALLOC_READERS || '0');
|
||||
const max_read_vus = parseInt(__ENV.MAX_READERS || pre_alloc_read_vus);
|
||||
const read_rate = parseInt(__ENV.READ_RATE || '0');
|
||||
if (read_rate > 0) {
|
||||
scenarios.read = {
|
||||
executor: 'constant-arrival-rate',
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: pre_alloc_write_vus,
|
||||
maxVUs: max_read_vus,
|
||||
rate: read_rate,
|
||||
timeUnit: time_unit,
|
||||
exec: 'obj_read',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-arrival-rate',
|
||||
duration : `${duration}s`,
|
||||
preAllocatedVUs : pre_alloc_write_vus,
|
||||
maxVUs : max_read_vus,
|
||||
rate : read_rate,
|
||||
timeUnit : time_unit,
|
||||
exec : 'obj_read',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
const pre_alloc_delete_vus = parseInt(__ENV.PRE_ALLOC_DELETERS || '0');
|
||||
const max_delete_vus = parseInt(__ENV.MAX_DELETERS || pre_alloc_write_vus);
|
||||
const delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
||||
|
@ -114,20 +112,20 @@ if (delete_rate > 0) {
|
|||
}
|
||||
|
||||
scenarios.delete = {
|
||||
executor: 'constant-arrival-rate',
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: pre_alloc_delete_vus,
|
||||
maxVUs: max_delete_vus,
|
||||
rate: delete_rate,
|
||||
timeUnit: time_unit,
|
||||
exec: 'obj_delete',
|
||||
gracefulStop: '5s',
|
||||
executor : 'constant-arrival-rate',
|
||||
duration : `${duration}s`,
|
||||
preAllocatedVUs : pre_alloc_delete_vus,
|
||||
maxVUs : max_delete_vus,
|
||||
rate : delete_rate,
|
||||
timeUnit : time_unit,
|
||||
exec : 'obj_delete',
|
||||
gracefulStop : '5s',
|
||||
};
|
||||
}
|
||||
|
||||
export const options = {
|
||||
scenarios,
|
||||
setupTimeout: '5s',
|
||||
setupTimeout : '5s',
|
||||
};
|
||||
|
||||
export function setup() {
|
||||
|
@ -167,8 +165,8 @@ export function teardown(data) {
|
|||
|
||||
export function handleSummary(data) {
|
||||
return {
|
||||
'stdout': textSummary(data, {indent: ' ', enableColors: false}),
|
||||
[summary_json]: JSON.stringify(data),
|
||||
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||
[summary_json] : JSON.stringify(data),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -183,7 +181,7 @@ export function obj_write() {
|
|||
const payload = generator.genPayload();
|
||||
const resp = s3_client.put(bucket, key, payload);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket: bucket, key: key}).error(resp.error);
|
||||
log.withFields({bucket : bucket, key : key}).error(resp.error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -204,7 +202,7 @@ export function obj_read() {
|
|||
}
|
||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket: obj.s3_bucket, key: obj.s3_key})
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
|
||||
.error(resp.error);
|
||||
}
|
||||
return
|
||||
|
@ -214,7 +212,7 @@ export function obj_read() {
|
|||
|
||||
const resp = s3_client.get(obj.bucket, obj.object);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket: obj.bucket, key: obj.object}).error(resp.error);
|
||||
log.withFields({bucket : obj.bucket, key : obj.object}).error(resp.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +229,7 @@ export function obj_delete() {
|
|||
|
||||
const resp = s3_client.delete(obj.s3_bucket, obj.s3_key);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket: obj.s3_bucket, key: obj.s3_key, op: 'DELETE'})
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
return;
|
||||
}
|
||||
|
@ -244,6 +242,7 @@ export function obj_delete() {
|
|||
|
||||
const resp = s3_client.delete(obj.bucket, obj.object);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket: obj.bucket, key: obj.object, op : 'DELETE'}).error(resp.error);
|
||||
log.withFields({bucket : obj.bucket, key : obj.object, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ const delete_age = __ENV.DELETE_AGE ? parseInt(__ENV.DELETE_AGE) : undefined;
|
|||
let obj_to_delete_selector = undefined;
|
||||
let obj_to_delete_exit_on_null = undefined;
|
||||
|
||||
if (registry_enabled ) {
|
||||
if (registry_enabled) {
|
||||
obj_to_delete_exit_on_null = (write_vu_count == 0) && (read_vu_count == 0)
|
||||
|
||||
let constructor = obj_to_delete_exit_on_null ? registry.getOneshotSelector
|
||||
|
@ -100,8 +100,6 @@ if (registry_enabled ) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||
if (delete_vu_count > 0) {
|
||||
if (!obj_to_delete_selector) {
|
||||
|
@ -182,14 +180,20 @@ export function obj_read() {
|
|||
|
||||
if (obj_to_read_selector) {
|
||||
const obj = obj_to_read_selector.nextObject();
|
||||
if (!obj ) {
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, status: obj.status, op: `READ`})
|
||||
log.withFields({
|
||||
bucket : obj.s3_bucket,
|
||||
key : obj.s3_key,
|
||||
status : obj.status,
|
||||
op : `READ`
|
||||
})
|
||||
.error(resp.error);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
obj_registry.setObjectStatus(obj.id, obj.status, 'read');
|
||||
}
|
||||
|
||||
|
@ -221,7 +225,8 @@ export function obj_delete() {
|
|||
|
||||
const resp = s3_client.delete(obj.bucket, obj.object);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket: obj.bucket, key: obj.object, op : 'DELETE'}).error(resp.error);
|
||||
log.withFields({bucket : obj.bucket, key : obj.object, op : 'DELETE'})
|
||||
.error(resp.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue