From b5ce51a72e482d0f2c7514549cc0da309e42a8ff Mon Sep 17 00:00:00 2001 From: Yaroslava Lukoyanova Date: Fri, 19 Apr 2024 19:06:10 +0300 Subject: [PATCH] [#218] 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 927e570d..1612ea64 100644 --- a/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py +++ b/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py @@ -19,13 +19,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: WalletInfo): 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) @@ -50,6 +56,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(