clear opensearch data for integration tests
This commit is contained in:
parent
ab3c57705a
commit
9fc29c29ac
1 changed files with 10 additions and 0 deletions
|
|
@ -28,11 +28,21 @@ async def onboard_system():
|
||||||
so that tests can use the /settings endpoint.
|
so that tests can use the /settings endpoint.
|
||||||
"""
|
"""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
|
||||||
# Delete any existing config to ensure clean onboarding
|
# Delete any existing config to ensure clean onboarding
|
||||||
config_file = Path("config/config.yaml")
|
config_file = Path("config/config.yaml")
|
||||||
if config_file.exists():
|
if config_file.exists():
|
||||||
config_file.unlink()
|
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
|
# Initialize clients
|
||||||
await clients.initialize()
|
await clients.initialize()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue