Add check for Error while deleting objects #32

Merged
JuliaKovshova merged 1 commit from EliChin/frostfs-testcases:feature/delete_objects into master 2023-05-02 12:22:09 +00:00
Member

Signed-off-by: Liza e.chichindaeva@yadro.com

Signed-off-by: Liza <e.chichindaeva@yadro.com>
EliChin requested review from JuliaKovshova 2023-04-18 14:54:14 +00:00
EliChin requested review from abereziny 2023-04-18 14:54:14 +00:00
JuliaKovshova reviewed 2023-04-18 15:03:38 +00:00
@ -169,0 +169,4 @@
if not isinstance(s3_client, AwsCliClient):
if "Error" in response:
logger.error("Deletion failed for specific object(s)")
raise
Member

please raise specific error

please raise specific error
abereziny marked this conversation as resolved
abereziny requested changes 2023-04-18 16:05:20 +00:00
@ -166,6 +166,10 @@ def delete_object_s3(
def delete_objects_s3(s3_client, bucket: str, object_keys: list):
try:
response = s3_client.delete_objects(Bucket=bucket, Delete=_make_objs_dict(object_keys))
if not isinstance(s3_client, AwsCliClient):
Member

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.

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.
Author
Member

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.

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.
Member

Is the OBJECT_NOT_FOUND the one and only error which we want to check?

This can be simplified to just:

assert "Errors" not in response, f"The following objects have not been <...>"

The must have here is to preserve original error messages in a some way in our exception.

Is the OBJECT_NOT_FOUND the one and only error which we want to check? This can be simplified to just: ``` assert "Errors" not in response, f"The following objects have not been <...>" ``` The must have here is to preserve original error messages in a some way in our exception.
abereziny marked this conversation as resolved
abereziny reviewed 2023-04-18 16:09:49 +00:00
@ -168,1 +168,4 @@
response = s3_client.delete_objects(Bucket=bucket, Delete=_make_objs_dict(object_keys))
if not isinstance(s3_client, AwsCliClient):
if "Error" in response:
logger.error("Deletion failed for specific object(s)")
Member

It would be nice to include error message in logger output

It would be nice to include error message in logger output
abereziny marked this conversation as resolved
EliChin force-pushed feature/delete_objects from 1951d2e898 to 962fb6847b 2023-04-20 15:19:36 +00:00 Compare
EliChin requested review from abereziny 2023-04-20 15:24:12 +00:00
abereziny requested review from qa-developers 2023-04-21 08:23:53 +00:00
abereziny requested review from qa-committers 2023-04-21 08:23:53 +00:00
EliChin force-pushed feature/delete_objects from 962fb6847b to 10a9d9b707 2023-04-24 12:34:58 +00:00 Compare
abereziny approved these changes 2023-04-25 08:21:34 +00:00
abereziny reviewed 2023-04-25 08:21:58 +00:00
@ -8,6 +9,7 @@ import allure
import pytest
import urllib3
from botocore.exceptions import ClientError
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND
Member

It's not required anymore

It's not required anymore
Author
Member

deleted

deleted
abereziny marked this conversation as resolved
abereziny reviewed 2023-04-25 08:22:02 +00:00
@ -1,5 +1,6 @@
import logging
import os
import re
Member

It's not required anymore

It's not required anymore
Author
Member

deleted

deleted
abereziny marked this conversation as resolved
EliChin force-pushed feature/delete_objects from 10a9d9b707 to 91b8fefed6 2023-04-25 09:17:00 +00:00 Compare
EliChin requested review from abereziny 2023-04-25 09:26:09 +00:00
EliChin requested review from qa-committers 2023-04-25 09:26:40 +00:00
anikeev-yadro approved these changes 2023-04-25 09:29:31 +00:00
abereziny approved these changes 2023-04-25 10:28:44 +00:00
abereziny requested review from qa-developers 2023-04-25 10:29:36 +00:00
abereziny approved these changes 2023-04-25 10:29:47 +00:00
abereziny requested review from anikeev-yadro 2023-04-25 11:00:20 +00:00
anikeev-yadro approved these changes 2023-04-25 16:59:48 +00:00
EliChin force-pushed feature/delete_objects from 91b8fefed6 to 532d58abc7 2023-05-02 08:12:20 +00:00 Compare
JuliaKovshova approved these changes 2023-05-02 12:21:06 +00:00
JuliaKovshova merged commit 532d58abc7 into master 2023-05-02 12:22:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-testcases#32
No description provided.