From 9fc29c29ac4f7bee3a175d9b20f8e6d410d5ab66 Mon Sep 17 00:00:00 2001 From: phact Date: Thu, 20 Nov 2025 13:54:34 -0500 Subject: [PATCH] clear opensearch data for integration tests --- tests/conftest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 210b7bc8..16885fc1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -28,11 +28,21 @@ async def onboard_system(): so that tests can use the /settings endpoint. """ from pathlib import Path + import shutil # Delete any existing config to ensure clean onboarding config_file = Path("config/config.yaml") if config_file.exists(): config_file.unlink() + + # Clean up OpenSearch data directory to ensure fresh state for tests + opensearch_data_path = Path(os.getenv("OPENSEARCH_DATA_PATH", "./opensearch-data")) + if opensearch_data_path.exists(): + try: + shutil.rmtree(opensearch_data_path) + print(f"[DEBUG] Cleaned up OpenSearch data directory: {opensearch_data_path}") + except Exception as e: + print(f"[DEBUG] Could not clean OpenSearch data directory: {e}") # Initialize clients await clients.initialize()