Skip to main content
Glama
README.mdโ€ข4.91 kB
# Codex Bridge Testing Suite This directory contains comprehensive tests for the Codex Bridge MCP server. ## ๐Ÿ“ Test Structure ``` tests/ โ”œโ”€โ”€ README.md # This file - testing overview โ”œโ”€โ”€ test_mcp_tools.py # Main test suite for all MCP tools โ”œโ”€โ”€ TEST_RESULTS.md # Latest test execution results โ””โ”€โ”€ test_reports/ # Historical test reports (future) ``` ## ๐Ÿงช Running Tests ### Prerequisites - Codex CLI installed and authenticated (`codex --version`) - Python 3.10+ with MCP server dependencies - Local development environment set up ### Quick Test ```bash # Run from project root python tests/test_mcp_tools.py ``` ### Individual Test Functions ```python # Import specific tests if needed from tests.test_mcp_tools import test_basic_consult_codex, test_git_skip_check # Run individual tests test_basic_consult_codex() test_git_skip_check() ``` ## ๐Ÿ” Test Categories ### 1. Core Functionality Tests - **Basic consult_codex:** Text and JSON format responses - **Code format:** Code block extraction and formatting - **Stdin processing:** Pipeline-friendly content processing - **Batch processing:** Multiple query handling ### 2. Environment & Configuration Tests - **CODEX_SKIP_GIT_CHECK:** Git repository bypass functionality - **Timeout handling:** Custom timeout configuration - **Directory validation:** Path security checks ### 3. Error Handling Tests - **Invalid parameters:** Format validation, directory checks - **CLI availability:** Codex CLI detection - **JSON consistency:** Structured error responses ## ๐Ÿ“Š Test Results Interpretation ### Success Indicators - โœ… **Green checkmarks:** Test passed - **Response lengths:** Typical 300-5000 characters - **JSON validity:** All JSON responses parse correctly - **Code block detection:** 1-7 blocks found per query ### Failure Indicators - โŒ **Red X marks:** Test failed - **Error messages:** Specific failure reasons - **JSON parsing errors:** Invalid response format ## ๐Ÿ”ง Troubleshooting Tests ### Common Issues 1. **"CLI not available"** - Install: `npm install -g @openai/codex-cli` - Authenticate: `codex auth login` 2. **"Git repository" errors** - Normal behavior in non-git directories - Use `CODEX_SKIP_GIT_CHECK=true` if needed 3. **Timeout errors** - Increase timeout: `CODEX_TIMEOUT=120` - Check network connectivity ### Debug Mode ```python # Add debug prints to test functions def test_basic_consult_codex(): print("๐Ÿ› Debug: Starting basic test...") result = consult_codex(query="test", directory=".", format="json") print(f"๐Ÿ› Debug: Raw result: {result[:200]}...") ``` ## ๐Ÿ“ Adding New Tests ### Test Function Template ```python def test_new_feature(): """Test description""" print("๐Ÿงช Testing new feature...") # Setup test_input = "example input" # Execute result = consult_codex( query=test_input, directory="/path/to/test/dir", format="json" ) # Validate try: parsed = json.loads(result) if parsed.get("status") == "success": print("โœ… New feature test passed") else: print("โŒ New feature test failed") except json.JSONDecodeError: print("โŒ New feature returned invalid JSON") print() ``` ### Test Checklist - [ ] Clear test description and purpose - [ ] Proper setup and cleanup - [ ] Multiple test cases (success/error) - [ ] JSON validation where applicable - [ ] Clear success/failure indicators - [ ] Integration with main test suite ## ๐Ÿ“‹ Test Maintenance ### Regular Testing - Run full suite before releases - Test after environment changes - Validate after dependency updates ### Test Data Management - Keep test queries simple and reliable - Use deterministic test inputs when possible - Document expected response patterns ### CI/CD Integration (Future) ```yaml # Example GitHub Actions test step - name: Run MCP Tools Tests run: python tests/test_mcp_tools.py env: CODEX_TIMEOUT: 120 CODEX_SKIP_GIT_CHECK: true ``` ## ๐Ÿš€ Performance Testing ### Response Time Benchmarks - Basic queries: 4-15 seconds - Code generation: 10-20 seconds - File analysis: 15-30 seconds - Batch processing: 30-60 seconds ### Load Testing (Future) - Multiple concurrent requests - Memory usage monitoring - Timeout behavior under load ## ๐Ÿ“Š Test Coverage ### Current Coverage - โœ… All three MCP tools tested - โœ… All output formats (text, json, code) - โœ… Error conditions covered - โœ… Environment variables tested - โœ… Git repository checks validated ### Future Coverage Goals - Integration tests with real MCP clients - Performance regression testing - Cross-platform compatibility tests - Extended timeout scenarios --- For questions about testing, see [CONTRIBUTING.md](../CONTRIBUTING.md) or open an issue on GitHub.

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/eLyiN/codex-bridge'

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