Skip to content

Commit

Permalink
fix logging for failed index deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Amnah199 committed Dec 9, 2024
1 parent 1959ab1 commit b1f522d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions integrations/azure_ai_search/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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.info(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}")

0 comments on commit b1f522d

Please sign in to comment.