forked from TrueCloudLab/xk6-frostfs
Added delete object after read
Signed-off-by: m.malygina <m.malygina@yadro.com>
This commit is contained in:
parent
3dd559a7b1
commit
81fe6e85a0
1 changed files with 11 additions and 0 deletions
|
@ -25,6 +25,7 @@ const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
|||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
||||
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
||||
const delete_after_read = __ENV.DELETE_AFTER_READ || 'true';
|
||||
const connection_args = {
|
||||
no_verify_ssl : no_verify_ssl
|
||||
}
|
||||
|
@ -184,6 +185,8 @@ export function obj_read() {
|
|||
if (!resp.success) {
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
|
||||
.error(resp.error);
|
||||
} else if (delete_after_read) {
|
||||
delete_object(obj)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -193,6 +196,8 @@ 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);
|
||||
} else if (delete_after_read) {
|
||||
delete_object(obj)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,6 +207,10 @@ export function obj_delete() {
|
|||
}
|
||||
|
||||
const obj = obj_to_delete_selector.nextObject();
|
||||
delete_object(obj)
|
||||
}
|
||||
|
||||
export function delete_object(obj) {
|
||||
if (!obj) {
|
||||
if (obj_to_delete_exit_on_null) {
|
||||
exec.test.abort("No more objects to select");
|
||||
|
@ -218,3 +227,5 @@ export function obj_delete() {
|
|||
|
||||
obj_registry.deleteObject(obj.id);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue