[#154] scenarios: Delete data created in preset
All checks were successful
DCO action / DCO (pull_request) Successful in 56s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m28s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m35s
Tests and linters / Lint (pull_request) Successful in 1m55s
Tests and linters / Tests with -race (pull_request) Successful in 2m10s
All checks were successful
DCO action / DCO (pull_request) Successful in 56s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m28s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m35s
Tests and linters / Lint (pull_request) Successful in 1m55s
Tests and linters / Tests with -race (pull_request) Successful in 2m10s
* Currently, objects created in preset are never deleted. k6 deletes only objects from registry, if registry file is not provided k6 delete load fails. * Changed delete scenarios so they check if registry was provided and if it is not empty, and if not, they try deleting objects created in preset. Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
9b9db46a07
commit
4ec75a1c89
6 changed files with 118 additions and 60 deletions
|
@ -101,9 +101,9 @@ if (read_vu_count > 0) {
|
||||||
|
|
||||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||||
if (delete_vu_count > 0) {
|
if (delete_vu_count > 0) {
|
||||||
if (!obj_to_delete_selector) {
|
if (!obj_to_delete_selector && !obj_list.length) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Positive DELETE worker number without a proper object selector');
|
'Positive DELETE worker number without a proper object selector or any preloaded objects');
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
|
@ -203,20 +203,27 @@ export function obj_delete() {
|
||||||
sleep(__ENV.SLEEP_DELETE);
|
sleep(__ENV.SLEEP_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const obj = obj_to_delete_selector.nextObject();
|
if (obj_to_delete_selector) {
|
||||||
if (!obj) {
|
const obj = obj_to_delete_selector.nextObject();
|
||||||
if (obj_to_delete_exit_on_null) {
|
if (!obj) {
|
||||||
exec.test.abort("No more objects to select");
|
if (obj_to_delete_exit_on_null) {
|
||||||
|
exec.test.abort("No more objects to select");
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
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);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
|
const resp = grpc_client.delete(obj.container, obj.object)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
log.withFields({ cid: obj.container, oid: obj.object, op : 'DELETE' }).error(resp.error);
|
||||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,9 +107,9 @@ const pre_alloc_delete_vus = parseInt(__ENV.PRE_ALLOC_DELETERS || '0');
|
||||||
const max_delete_vus = parseInt(__ENV.MAX_DELETERS || pre_alloc_write_vus);
|
const max_delete_vus = parseInt(__ENV.MAX_DELETERS || pre_alloc_write_vus);
|
||||||
const delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
const delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
||||||
if (delete_rate > 0) {
|
if (delete_rate > 0) {
|
||||||
if (!obj_to_delete_selector) {
|
if (!obj_to_delete_selector && !obj_list.length) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Positive DELETE worker number without a proper object selector');
|
'Positive DELETE worker number without a proper object selector or any preloaded objects');
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
|
@ -222,17 +222,26 @@ export function obj_delete() {
|
||||||
sleep(__ENV.SLEEP_DELETE);
|
sleep(__ENV.SLEEP_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const obj = obj_to_delete_selector.nextObject();
|
if (obj_to_delete_selector) {
|
||||||
if (!obj) {
|
const obj = obj_to_delete_selector.nextObject();
|
||||||
return;
|
if (!obj) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
|
const resp = grpc_client.delete(obj.container, obj.object)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
log.withFields({ cid: obj.container, oid: obj.object, op : 'DELETE' }).error(resp.error);
|
||||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,9 @@ if (read_vu_count > 0) {
|
||||||
|
|
||||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||||
if (delete_vu_count > 0) {
|
if (delete_vu_count > 0) {
|
||||||
if (!obj_to_delete_selector) {
|
if (!obj_to_delete_selector && !obj_list.length) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Positive DELETE worker number without a proper object selector');
|
'Positive DELETE worker number without a proper object selector or any preloaded objects');
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
|
@ -161,17 +161,27 @@ export function obj_read() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function obj_delete() {
|
export function obj_delete() {
|
||||||
const obj = obj_to_delete_selector.nextObject();
|
if (obj_to_delete_selector) {
|
||||||
if (!obj) {
|
const obj = obj_to_delete_selector.nextObject();
|
||||||
return;
|
if (!obj) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = local_client.delete(obj.c_id, obj.o_id);
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
|
const resp = grpc_client.delete(obj.container, obj.object)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
log.withFields({cid : obj.container, oid : obj.object, op : 'DELETE'})
|
||||||
log.withFields({cid: obj.c_id, oid: obj.o_id}).error(resp.error);
|
.error(resp.error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,9 @@ if (read_vu_count > 0) {
|
||||||
|
|
||||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||||
if (delete_vu_count > 0) {
|
if (delete_vu_count > 0) {
|
||||||
if (!obj_to_delete_selector) {
|
if (!obj_to_delete_selector && !obj_list.length) {
|
||||||
throw 'Positive DELETE worker number without a proper object selector';
|
throw new Error(
|
||||||
|
'Positive DELETE worker number without a proper object selector or any preloaded objects');
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
|
@ -201,20 +202,30 @@ export function obj_delete() {
|
||||||
sleep(__ENV.SLEEP_DELETE);
|
sleep(__ENV.SLEEP_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const obj = obj_to_delete_selector.nextObject();
|
if (obj_to_delete_selector) {
|
||||||
if (!obj) {
|
const obj = obj_to_delete_selector.nextObject();
|
||||||
if (obj_to_delete_exit_on_null) {
|
if (!obj) {
|
||||||
exec.test.abort("No more objects to select");
|
if (obj_to_delete_exit_on_null) {
|
||||||
|
exec.test.abort("No more objects to select");
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
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'})
|
||||||
|
.error(resp.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = s3_client.delete(obj.s3_bucket, obj.s3_key);
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
|
|
||||||
|
const resp = s3_client.delete(obj.bucket, obj.object);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'})
|
log.withFields({bucket : obj.bucket, key : obj.object, op : 'DELETE'}).error(resp.error);
|
||||||
.error(resp.error);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,9 +108,9 @@ const pre_alloc_delete_vus = parseInt(__ENV.PRE_ALLOC_DELETERS || '0');
|
||||||
const max_delete_vus = parseInt(__ENV.MAX_DELETERS || pre_alloc_write_vus);
|
const max_delete_vus = parseInt(__ENV.MAX_DELETERS || pre_alloc_write_vus);
|
||||||
const delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
const delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
||||||
if (delete_rate > 0) {
|
if (delete_rate > 0) {
|
||||||
if (!obj_to_delete_selector) {
|
if (!obj_to_delete_selector && !obj_list.length) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Positive DELETE worker number without a proper object selector');
|
'Positive DELETE worker number without a proper object selector or any preloaded objects');
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
|
@ -223,17 +223,27 @@ export function obj_delete() {
|
||||||
sleep(__ENV.SLEEP_DELETE);
|
sleep(__ENV.SLEEP_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const obj = obj_to_delete_selector.nextObject();
|
if (obj_to_delete_selector) {
|
||||||
if (!obj) {
|
const obj = obj_to_delete_selector.nextObject();
|
||||||
return;
|
if (!obj) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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'})
|
||||||
|
.error(resp.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = s3_client.delete(obj.s3_bucket, obj.s3_key);
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
|
|
||||||
|
const resp = s3_client.delete(obj.bucket, obj.object);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: obj.s3_bucket, key: obj.s3_key, op: 'DELETE'})
|
log.withFields({bucket: obj.bucket, key: obj.object, op : 'DELETE'}).error(resp.error);
|
||||||
.error(resp.error);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,8 @@ if (registry_enabled ) {
|
||||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||||
if (delete_vu_count > 0) {
|
if (delete_vu_count > 0) {
|
||||||
if (!obj_to_delete_selector) {
|
if (!obj_to_delete_selector) {
|
||||||
throw 'Positive DELETE worker number without a proper object selector';
|
throw new Error(
|
||||||
|
'Positive DELETE worker number without a proper object selector');
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
|
@ -210,8 +211,18 @@ export function obj_delete() {
|
||||||
sleep(__ENV.SLEEP_DELETE);
|
sleep(__ENV.SLEEP_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj_to_delete_selector) {
|
||||||
const obj = obj_to_delete_selector.nextObject();
|
const obj = obj_to_delete_selector.nextObject();
|
||||||
delete_object(obj)
|
delete_object(obj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function delete_object(obj) {
|
export function delete_object(obj) {
|
||||||
|
|
Loading…
Reference in a new issue