From 048f713f3f8f325216dbbe6afbf10f8328eb765e Mon Sep 17 00:00:00 2001 From: Yaroslava Lukoyanova Date: Mon, 22 Apr 2024 14:12:39 +0300 Subject: [PATCH] [#219] Add bucket/container listing check in multipart test case --- .../services/s3_gate/test_s3_multipart.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py b/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py index 12f1e93d..7cb3742b 100644 --- a/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py +++ b/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py @@ -17,13 +17,18 @@ class TestS3GateMultipart(ClusterTestBase): @allure.title("Object Multipart API (s3_client={s3_client})") @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True) - def test_s3_object_multipart(self, s3_client: S3ClientWrapper, bucket: str): + def test_s3_object_multipart(self, s3_client: S3ClientWrapper, bucket: str, default_wallet: str): parts_count = 5 file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part object_key = s3_helper.object_key_from_file_path(file_name_large) part_files = split_file(file_name_large, parts_count) parts = [] + with allure.step(f"Get related container_id for bucket"): + for cluster_node in self.cluster.cluster_nodes: + container_id = search_container_by_name(bucket, cluster_node) + if container_id: + break with allure.step("Upload first part"): upload_id = s3_client.create_multipart_upload(bucket, object_key) uploads = s3_client.list_multipart_uploads(bucket) @@ -48,6 +53,17 @@ class TestS3GateMultipart(ClusterTestBase): got_object = s3_client.get_object(bucket, object_key) assert get_file_hash(got_object) == get_file_hash(file_name_large) + with allure.step("Delete the object"): + s3_client.delete_object(bucket, object_key) + + with allure.step("List objects in the bucket, expect to be empty"): + objects_list = s3_client.list_objects(bucket) + assert not objects_list, f"Expected empty bucket, got {objects_list}" + + with allure.step("List objects in the container via rpc, expect to be empty"): + objects = list_objects(default_wallet, self.shell, container_id, self.cluster.default_rpc_endpoint) + assert len(objects) == 0, f"Expected no objects in container, got\n{objects}" + @allure.title("Abort Multipart Upload (s3_client={s3_client})") @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True) def test_s3_abort_multipart(