[#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

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2024-07-25 18:38:51 +03:00
parent 4ec75a1c89
commit 5f20d5d88a
6 changed files with 337 additions and 326 deletions

View file

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

View file

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

View file

@ -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';

View file

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

View file

@ -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';
@ -86,7 +86,6 @@ if (write_rate > 0) {
};
}
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');
@ -103,7 +102,6 @@ if (read_rate > 0) {
};
}
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');
@ -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);
}
}

View file

@ -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) {
@ -187,9 +185,15 @@ 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, 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);
}
}