Added new test cases for s3 gate, delete marker feature #35

Merged
abereziny merged 2 commits from ylukoyan/frostfs-testcases:delete_markers into master 2023-05-12 08:48:29 +00:00
Showing only changes of commit cfd567df58 - Show all commits

View file

@ -949,3 +949,56 @@ class TestS3GateObject(TestS3GateBase):
with allure.step("Put object"): with allure.step("Put object"):
s3_gate_object.put_object_s3(self.s3_client, bucket, file_path_1) s3_gate_object.put_object_s3(self.s3_client, bucket, file_path_1)
check_objects_in_bucket(self.s3_client, bucket, [file_name]) check_objects_in_bucket(self.s3_client, bucket, [file_name])
@allure.title("Test S3: Delete non-existing object from empty bucket")
def test_s3_delete_non_existing_object(self, bucket):
set_bucket_versioning(self.s3_client, bucket, s3_gate_bucket.VersioningStatus.ENABLED)
objects_list = s3_gate_object.list_objects_versions_s3(self.s3_client, bucket)
with allure.step("Check that bucket is empty"):

please add allure step descriprion befor this assert.

please add allure step descriprion befor this assert.
assert not objects_list, f"Expected empty bucket, got {objects_list}"
obj_key = "fake_object_key"
with allure.step("Delete non-existing object"):
delete_obj = s3_gate_object.delete_object_s3(self.s3_client, bucket, obj_key)
Review

do we have some error like "this key doesn't exist"?
i think we need additional asseert for this.

do we have some error like "this key doesn't exist"? i think we need additional asseert for this.
# there should be no objects or delete markers in the bucket
abereziny marked this conversation as resolved Outdated

Error message is misleading. We are expecting Delete markers to not exist, so we shouldn't report it as assertion error message.

"Delete markers should not be created" or smthg

Error message is misleading. We are **expecting** Delete markers to not exist, so we shouldn't report it as assertion error message. "Delete markers should not be created" or smthg
assert "DeleteMarker" not in delete_obj.keys(), "Delete markers should not be created"
objects_list = s3_gate_object.list_objects_versions_s3(self.s3_client, bucket)
assert not objects_list, f"Expected empty bucket, got {objects_list}"
@allure.title("Test S3: Delete the same object twice")
def test_s3_delete_twice(self, bucket, simple_object_size):
set_bucket_versioning(self.s3_client, bucket, s3_gate_bucket.VersioningStatus.ENABLED)
objects_list = s3_gate_object.list_objects_s3(self.s3_client, bucket)

please add allure step descriprion befor this assert.

please add allure step descriprion befor this assert.
with allure.step("Check that bucket is empty"):
assert not objects_list, f"Expected empty bucket, got {objects_list}"
file_path = generate_file(simple_object_size)
file_name = self.object_key_from_file_path(file_path)
with allure.step("Put object into one bucket"):
s3_gate_object.put_object_s3(self.s3_client, bucket, file_path)
Review

please add check for this step.

please add check for this step.
with allure.step("Delete the object from the bucket"):
delete_object = s3_gate_object.delete_object_s3(self.s3_client, bucket, file_name)
versions = s3_gate_object.list_objects_versions_s3(self.s3_client, bucket)
obj_versions = {
version.get("VersionId") for version in versions if version.get("Key") == file_name
}
abereziny marked this conversation as resolved Outdated

why are we not expecting delete markers here? Also same misleading text.

why are we not expecting delete markers here? Also same misleading text.

Nice catch, thanks! Will be fixed

Nice catch, thanks! Will be fixed
assert obj_versions, f"Object versions were not found {objects_list}"
assert "DeleteMarker" in delete_object.keys(), "Delete markers not found"
with allure.step("Delete the object from the bucket again"):
delete_object_2nd_attempt = s3_gate_object.delete_object_s3(
self.s3_client, bucket, file_name
)
versions_2nd_attempt = s3_gate_object.list_objects_versions_s3(self.s3_client, bucket)
assert (
abereziny marked this conversation as resolved Outdated

How can we check delete markers here if we are not expecting it at line 989?

How can we check delete markers here if we are not expecting it at line 989?
delete_object.keys() == delete_object_2nd_attempt.keys()
), "Delete markers are not the same"
# check that nothing was changed
# checking here not VersionId only, but all data (for example LastModified)
assert versions == versions_2nd_attempt, "Versions are not the same"