[#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,6 +203,7 @@ 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();
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
if (obj_to_delete_exit_on_null) {
|
if (obj_to_delete_exit_on_null) {
|
||||||
|
@ -210,13 +211,19 @@ export function obj_delete() {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
// 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, op : 'DELETE' }).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,6 +222,7 @@ 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();
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
return;
|
return;
|
||||||
|
@ -230,9 +231,17 @@ export function obj_delete() {
|
||||||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
// 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, op : 'DELETE' }).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,6 +161,7 @@ export function obj_read() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function obj_delete() {
|
export function obj_delete() {
|
||||||
|
if (obj_to_delete_selector) {
|
||||||
const obj = obj_to_delete_selector.nextObject();
|
const obj = obj_to_delete_selector.nextObject();
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
return;
|
return;
|
||||||
|
@ -174,4 +175,13 @@ export function obj_delete() {
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
obj_registry.deleteObject(obj.id);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,6 +202,7 @@ 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();
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
if (obj_to_delete_exit_on_null) {
|
if (obj_to_delete_exit_on_null) {
|
||||||
|
@ -217,4 +219,13 @@ export function obj_delete() {
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
obj_registry.deleteObject(obj.id);
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,6 +223,7 @@ 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();
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
return;
|
return;
|
||||||
|
@ -236,4 +237,13 @@ export function obj_delete() {
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_registry.deleteObject(obj.id);
|
obj_registry.deleteObject(obj.id);
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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