From 574316d8724470ae4185fd8f0bc4440befc0f1cc Mon Sep 17 00:00:00 2001 From: Amna Mubashar Date: Tue, 10 Dec 2024 16:06:02 +0100 Subject: [PATCH] fix: logger for index deletion failures in Azure AI (#1240) * fix logging for failed index deletion --- integrations/azure_ai_search/tests/conftest.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/integrations/azure_ai_search/tests/conftest.py b/integrations/azure_ai_search/tests/conftest.py index 89369c87e..e741e3066 100644 --- a/integrations/azure_ai_search/tests/conftest.py +++ b/integrations/azure_ai_search/tests/conftest.py @@ -11,9 +11,12 @@ from haystack_integrations.document_stores.azure_ai_search import AzureAISearchDocumentStore +logger = logging.getLogger(__name__) + + # This is the approximate time in seconds it takes for the documents to be available in Azure Search index SLEEP_TIME_IN_SECONDS = 10 -MAX_WAIT_TIME_FOR_INDEX_DELETION = 5 +MAX_WAIT_TIME_FOR_INDEX_DELETION = 10 @pytest.fixture() @@ -75,8 +78,8 @@ def wait_for_index_deletion(client, index_name): try: client.delete_index(index_name) if not wait_for_index_deletion(client, index_name): - logging.error(f"Index {index_name} was not properly deleted.") + logger.error(f"Index {index_name} was not properly deleted.") except ResourceNotFoundError: - logging.info(f"Index {index_name} was already deleted or not found.") + logger.error(f"Index {index_name} was already deleted or not found.") except Exception as e: - logging.error(f"Unexpected error when deleting index {index_name}: {e}") + logger.error(f"Unexpected error when deleting index {index_name}: {e}")