Added read status to obj

Signed-off-by: m.malygina <m.malygina@yadro.com>
This commit is contained in:
m.malygina 2024-06-05 17:50:59 +03:00
parent 0477552ee5
commit 11d82924e9

View file

@ -25,8 +25,6 @@ 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
}
@ -186,8 +184,6 @@ 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
}
@ -197,8 +193,6 @@ 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)
}
}
@ -208,10 +202,6 @@ 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");
@ -224,12 +214,7 @@ export function delete_object(obj) {
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'})
.error(resp.error);
return;
} else {
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
.info("deleted successfully");
}
obj_registry.deleteObject(obj.id);
}