From 8d5040743921644c5b6f49ab240e7c0e55198dde Mon Sep 17 00:00:00 2001 From: Yaroslava Lukoyanova Date: Mon, 22 May 2023 09:55:51 +0300 Subject: [PATCH] Add pilorama loss test cases, marked as skipped --- .../failovers/test_failover_storage.py | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/pytest_tests/testsuites/failovers/test_failover_storage.py b/pytest_tests/testsuites/failovers/test_failover_storage.py index 3e3d466f..a916be7c 100644 --- a/pytest_tests/testsuites/failovers/test_failover_storage.py +++ b/pytest_tests/testsuites/failovers/test_failover_storage.py @@ -445,3 +445,58 @@ class TestEmptyMap(ClusterTestBase): with allure.step("Delete bucket"): s3_client.delete_bucket(bucket) + + @pytest.mark.skip(reason="Need to increase cache lifetime") + @pytest.mark.parametrize( + # versioning should NOT be VersioningStatus.SUSPENDED, it needs to be undefined + "versioning_status", + [VersioningStatus.ENABLED, None], + ) + @allure.title( + "After Pilorama.db loss on all nodes list objects should return nothing in second listing" + ) + def test_s3_pilorama_loss( + self, + s3_client: S3ClientWrapper, + simple_object_size: int, + versioning_status: VersioningStatus, + ): + bucket = s3_client.create_bucket() + if versioning_status: + s3_helper.set_bucket_versioning(s3_client, bucket, versioning_status) + + file_path = generate_file(simple_object_size) + file_name = s3_helper.object_key_from_file_path(file_path) + + with allure.step("Put object into one bucket"): + s3_client.put_object(bucket, file_path) + s3_helper.check_objects_in_bucket(s3_client, bucket, expected_objects=[file_name]) + + with allure.step("Stop all storage nodes"): + for node in self.cluster.storage_nodes: + with allure.step(f"Stop storage service on node: {node}"): + node.stop_service() + stopped_nodes.append(node) + + with allure.step("Delete pilorama.db from all nodes"): + for node in self.cluster.storage_nodes: + node.delete_pilorama() + + with allure.step("Start all storage nodes"): + for node in list(stopped_nodes): + with allure.step(f"Start node {node}"): + node.start_service() + stopped_nodes.remove(node) + with allure.step(f"Waiting status ready for node {node}"): + wait_for_node_to_be_ready(node) + + with allure.step("Check list objects first time"): + objects_list = s3_client.list_objects(bucket) + assert objects_list, f"Expected not empty bucket" + + with allure.step("Check list objects second time"): + objects_list = s3_client.list_objects(bucket) + assert not objects_list, f"Expected empty bucket, got {objects_list}" + + with allure.step("Delete bucket"): + s3_client.delete_bucket(bucket)