test: Add checking of Networkx database deletion
Add test to check if networkx database has been cleaned properly Test COG-488
This commit is contained in:
parent
b815aeaa2a
commit
ac3f988278
2 changed files with 11 additions and 3 deletions
|
|
@ -57,15 +57,23 @@ async def main():
|
||||||
|
|
||||||
assert len(history) == 6, "Search history is not correct."
|
assert len(history) == 6, "Search history is not correct."
|
||||||
|
|
||||||
|
# Assert local data files are cleaned properly
|
||||||
await cognee.prune.prune_data()
|
await cognee.prune.prune_data()
|
||||||
assert not os.path.isdir(data_directory_path), "Local data files are not deleted"
|
assert not os.path.isdir(data_directory_path), "Local data files are not deleted"
|
||||||
|
|
||||||
|
# Assert relational, vector and graph databases have been cleaned properly
|
||||||
await cognee.prune.prune_system(metadata=True)
|
await cognee.prune.prune_system(metadata=True)
|
||||||
|
|
||||||
connection = await vector_engine.get_connection()
|
connection = await vector_engine.get_connection()
|
||||||
collection_names = await connection.table_names()
|
collection_names = await connection.table_names()
|
||||||
assert len(collection_names) == 0, "The vector database is not empty"
|
assert len(collection_names) == 0, "LanceDB vector database is not empty"
|
||||||
|
|
||||||
from cognee.infrastructure.databases.relational import get_relational_engine
|
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"
|
assert not os.path.exists(get_relational_engine().db_path), "SQLite relational database is not empty"
|
||||||
|
|
||||||
|
from cognee.infrastructure.databases.graph import get_graph_config
|
||||||
|
graph_config = get_graph_config()
|
||||||
|
assert not os.path.exists(graph_config.graph_file_path), "Networkx graph database is not empty"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ async def main():
|
||||||
|
|
||||||
await cognee.prune.prune_system(metadata=True)
|
await cognee.prune.prune_system(metadata=True)
|
||||||
tables_in_database = await vector_engine.get_table_names()
|
tables_in_database = await vector_engine.get_table_names()
|
||||||
assert len(tables_in_database) == 0, "The database is not empty"
|
assert len(tables_in_database) == 0, "PostgreSQL database is not empty"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue