forked from TrueCloudLab/frostfs-testcases
Added new test cases for s3 gate, delete marker feature
This commit is contained in:
parent
e86ed765b1
commit
ec9b62d439
1 changed files with 51 additions and 0 deletions
|
@ -949,3 +949,54 @@ 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)
|
||||||
|
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)
|
||||||
|
# there should be no objects or delete markers in the bucket
|
||||||
|
assert "DeleteMarkers" not in delete_obj.keys(), "Delete markers not found"
|
||||||
|
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)
|
||||||
|
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)
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
assert obj_versions, f"Object versions were not found {objects_list}"
|
||||||
|
assert "DeleteMarkers" not 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 (
|
||||||
|
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"
|
||||||
|
|
Loading…
Reference in a new issue