From 8944eee05759b418242ca0264965926f9d41b078 Mon Sep 17 00:00:00 2001 From: Yaroslava Lukoyanova Date: Mon, 22 Apr 2024 14:42:12 +0300 Subject: [PATCH] [#220] Add bucket/container listing check in multipart test case --- .../services/s3_gate/test_s3_multipart.py | 19 ++++++++++++++++++- 1 file changed, 18 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 c6e28bb4..509a3c90 100644 --- a/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py +++ b/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py @@ -18,13 +18,19 @@ 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 reporter.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 reporter.step("Upload first part"): upload_id = s3_client.create_multipart_upload(bucket, object_key) uploads = s3_client.list_multipart_uploads(bucket) @@ -49,6 +55,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 reporter.step("Delete the object"): + s3_client.delete_object(bucket, object_key) + + with reporter.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 reporter.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( -- 2.45.2