Skip to main content
Glama
test_fixes.md2.88 kB
# MCP Codebase Insight Test Fixes ## Identified Issues 1. **Package Import Problems** - The tests were trying to import from `mcp_codebase_insight` directly, but the package needed to be imported from `src.mcp_codebase_insight` - The Python path wasn't correctly set up to include the project root directory 2. **Missing Dependencies** - The `sentence-transformers` package was installed in the wrong Python environment (Python 3.13 instead of 3.11) - Had to explicitly install it in the correct environment 3. **Test Isolation Problems** - Tests were failing due to not being properly isolated - The `component_test_runner.py` script needed fixes to properly load test modules 4. **Qdrant Server Issue** - The `test_vector_store_cleanup` test failed due to permission issues in the Qdrant server - The server couldn't create a collection directory for the test ## Applied Fixes 1. **Fixed Import Paths** - Modified test files to use `from src.mcp_codebase_insight...` instead of `from mcp_codebase_insight...` - Added code to explicitly set `sys.path` to include the project root directory 2. **Fixed Dependency Issues** - Ran `python3.11 -m pip install sentence-transformers` to install the package in the correct environment - Verified all dependencies were properly installed 3. **Created a Test Runner Script** - Created `run_test_with_path_fix.sh` to set up the proper environment variables and paths - Modified `component_test_runner.py` to better handle module loading 4. **Fixed Test Module Loading** - Added a `load_test_module` function to properly handle import paths - Ensured the correct Python path is set before importing test modules ## Results - Successfully ran 2 out of 3 vector store tests: - ✅ `test_vector_store_initialization` - ✅ `test_vector_store_add_and_search` - ❌ `test_vector_store_cleanup` (still failing due to Qdrant server issue) ## Recommendations for Remaining Issue The `test_vector_store_cleanup` test is failing due to the Qdrant server not being able to create a directory for the collection. This could be fixed by: 1. Checking the Qdrant server configuration to ensure it has proper permissions to create directories 2. Creating the necessary directories beforehand 3. Modifying the test to use a collection name that already exists or mock the collection creation The error message suggests a file system permission issue: ``` "Can't create directory for collection cleanup_test_db679546. Error: No such file or directory (os error 2)" ``` A simpler fix for testing purposes might be to modify the Qdrant Docker run command to include a volume mount with proper permissions: ```bash docker run -d -p 6333:6333 -p 6334:6334 -v $(pwd)/qdrant_data:/qdrant/storage qdrant/qdrant ``` This would ensure the storage directory exists and has the right permissions.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tosin2013/mcp-codebase-insight'

If you have feedback or need assistance with the MCP directory API, please join our Discord server