test: Add test for database deletion for LanceDB and SQLite

Added database deletion test for LanceDB and SQLite

Test COG-488
This commit is contained in:
Igor Ilic 2024-11-21 13:44:09 +01:00
parent 27aade2a43
commit b815aeaa2a

View file

@ -57,6 +57,16 @@ async def main():
assert len(history) == 6, "Search history is not correct." assert len(history) == 6, "Search history is not correct."
await cognee.prune.prune_data()
assert not os.path.isdir(data_directory_path), "Local data files are not deleted"
await cognee.prune.prune_system(metadata=True)
connection = await vector_engine.get_connection()
collection_names = await connection.table_names()
assert len(collection_names) == 0, "The vector database is not empty"
from cognee.infrastructure.databases.relational import get_relational_engine
assert not os.path.exists(get_relational_engine().db_path), "The relational database is not empty"
if __name__ == "__main__": if __name__ == "__main__":
import asyncio import asyncio
asyncio.run(main(), debug=True) asyncio.run(main(), debug=True)