Add check for Error while deleting objects #32
1 changed files with 3 additions and 0 deletions
|
@ -168,6 +168,9 @@ def delete_objects_s3(s3_client, bucket: str, object_keys: list):
|
||||||
response = s3_client.delete_objects(Bucket=bucket, Delete=_make_objs_dict(object_keys))
|
response = s3_client.delete_objects(Bucket=bucket, Delete=_make_objs_dict(object_keys))
|
||||||
log_command_execution("S3 Delete objects result", response)
|
log_command_execution("S3 Delete objects result", response)
|
||||||
abereziny marked this conversation as resolved
Outdated
|
|||||||
sleep(S3_SYNC_WAIT_TIME)
|
sleep(S3_SYNC_WAIT_TIME)
|
||||||
|
assert (
|
||||||
abereziny marked this conversation as resolved
Outdated
abereziny
commented
It would be nice to include error message in logger output It would be nice to include error message in logger output
|
|||||||
|
"Errors" not in response
|
||||||
abereziny marked this conversation as resolved
Outdated
JuliaKovshova
commented
please raise specific error please raise specific error
|
|||||||
|
), f'The following objects have not been deleted: {[err_info["Key"] for err_info in response["Errors"]]}.\nError Message: {response["Errors"]["Message"]}'
|
||||||
return response
|
return response
|
||||||
|
|
||||||
except ClientError as err:
|
except ClientError as err:
|
||||||
|
|
Loading…
Reference in a new issue
What about boto3 client?
Also, I think it's bad practice to check errors here since we may have negative cases like this one:
https://git.frostfs.info/TrueCloudLab/frostfs-testcases/src/branch/master/pytest_tests/testsuites/services/s3_gate/test_s3_object.py#L531
This test will be broken after such changes.
I think it's a bad practice here to add this check in aaaall separate testcases, so I tried to check it more precisely here so that no problem will be with negative tests.
Is the OBJECT_NOT_FOUND the one and only error which we want to check?
This can be simplified to just:
The must have here is to preserve original error messages in a some way in our exception.