LightRAG/tests
BukeLy 0fb7c5bc3b test: add unit test for Case 1 sequential workspace migration bug
Add test_case1_sequential_workspace_migration to verify the fix for
the multi-tenant data loss bug in PostgreSQL Case 1 migration.

Problem:
- When workspace_a migrates first (Case 4: only legacy table exists)
- Then workspace_b initializes later (Case 1: both tables exist)
- Bug: Case 1 only checked if legacy table was globally empty
- Result: workspace_b's data was not migrated, causing data loss

Test Scenario:
1. Legacy table contains data from both workspace_a (3 records) and
   workspace_b (3 records)
2. workspace_a initializes first → triggers Case 4 migration
3. workspace_b initializes second → triggers Case 1 migration
4. Verify workspace_b's data is correctly migrated to new table
5. Verify workspace_b's data is deleted from legacy table
6. Verify legacy table is dropped when empty

This test uses mock tracking of inserted records to verify migration
behavior without requiring a real PostgreSQL database.

Related: GitHub PR #2391 comment #2553973066
2025-11-26 01:32:25 +08:00
..
conftest.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
README_WORKSPACE_ISOLATION_TESTS.md Fix linting 2025-11-18 08:07:54 +08:00
test_aquery_data_endpoint.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
test_base_storage_integrity.py style: fix lint errors (trailing whitespace and formatting) 2025-11-20 01:41:23 +08:00
test_curl_aquery_data.sh Fix linting 2025-10-06 04:57:11 +08:00
test_dimension_mismatch.py style: apply ruff formatting fixes to test files 2025-11-23 16:59:02 +08:00
test_e2e_multi_instance.py style: apply ruff formatting fixes to test files 2025-11-23 16:59:02 +08:00
test_embedding_func.py style: fix lint errors (trailing whitespace and formatting) 2025-11-20 01:41:23 +08:00
test_graph_storage.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
test_lightrag_ollama_chat.py Rename test classes to prevent warning from pytest 2025-11-18 13:33:05 +08:00
test_no_model_suffix_safety.py style: apply ruff formatting fixes to test files 2025-11-23 16:59:02 +08:00
test_postgres_migration.py test: add unit test for Case 1 sequential workspace migration bug 2025-11-26 01:32:25 +08:00
test_postgres_retry_integration.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
test_qdrant_migration.py feat: implement dimension compatibility checks for PostgreSQL and Qdrant migrations 2025-11-20 12:22:13 +08:00
test_unified_lock_safety.py style: apply ruff formatting fixes to test files 2025-11-23 16:59:02 +08:00
test_workspace_isolation.py Fix test to use default workspace parameter behavior 2025-11-18 11:51:17 +08:00
test_workspace_migration_isolation.py style: apply ruff formatting fixes to test files 2025-11-23 16:59:02 +08:00
test_write_json_optimization.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00