@@ -86,130 +86,54 @@ cp .env.template .env # Configure environment variables
8686sudo rm -rf backends/advanced/data/
8787```
8888
89- ### Testing Infrastructure
89+ ### Running Tests
9090
91- #### Local Test Scripts
92- The project includes simplified test scripts that mirror CI workflows :
91+ #### Quick Commands
92+ All test operations are managed through a simple Makefile interface :
9393
94- ``` bash
95- # Run all tests from project root
96- ./run-test.sh [advanced-backend| speaker-recognition| all]
97-
98- # Advanced backend tests only
99- ./run-test.sh advanced-backend
100-
101- # Speaker recognition tests only
102- ./run-test.sh speaker-recognition
103-
104- # Run all test suites (default)
105- ./run-test.sh all
106- ```
107-
108- #### Advanced Backend Integration Tests
109-
110- ** Three Test Execution Modes:**
111-
112- 1 . ** No-API Tests** (Fast, No External Dependencies)
11394``` bash
11495cd tests
11596
116- # Run tests without API keys (excludes requires-api-keys tag )
117- ./ run-no-api- tests.sh
97+ # Full test workflow (recommended )
98+ make test # Start containers + run all tests
11899
119- # ~70% of test suite
120- # Uses mock services config
121- # No DEEPGRAM_API_KEY or OPENAI_API_KEY required
122- # Fast feedback (~10-15 minutes)
123- ```
100+ # Or step by step
101+ make start # Start test containers (with health checks)
102+ make test-all # Run all test suites
103+ make stop # Stop containers (preserves volumes)
124104
125- 2 . ** Full Tests with API Keys** (Comprehensive)
126- ``` bash
127- cd tests
105+ # Run specific test suites
106+ make test-endpoints # API endpoint tests (~40 tests, fast)
107+ make test-integration # End-to-end workflows (~15 tests, slower)
108+ make test-infra # Infrastructure resilience (~5 tests)
128109
129- # Requires .env file with DEEPGRAM_API_KEY and OPENAI_API_KEY
130- cp setup/.env.test.template setup/.env.test # Configure API keys
110+ # Quick iteration (reuse existing containers)
111+ make test-quick # Run tests without restarting containers
112+ ```
131113
132- # Run full integration test suite (100% of tests)
133- ./run-robot-tests.sh
114+ #### Container Management
115+ All container operations automatically preserve logs before cleanup:
134116
135- # Leave test containers running for debugging
136- CLEANUP_CONTAINERS=false ./run-robot-tests.sh
117+ ``` bash
118+ make start # Start test containers
119+ make stop # Stop containers (keep volumes)
120+ make restart # Restart without rebuild
121+ make rebuild # Rebuild images + restart (for code changes)
122+ make containers-clean # SAVES LOGS → removes everything
123+ make status # Show container health
124+ make logs SERVICE=< name> # View specific service logs
137125```
138126
139- 3 . ** API-Only Tests** (Optional)
140- ``` bash
141- cd tests
127+ ** Log Preservation:** All cleanup operations save container logs to ` tests/logs/YYYY-MM-DD_HH-MM-SS/ `
142128
143- # Run only tests that require API keys
144- ./run-api-tests.sh
129+ #### Test Environment
145130
146- # ~30% of test suite
147- # Only E2E tests with transcription/memory extraction
148- ```
131+ Test services use isolated ports and database:
132+ - ** Ports:** Backend (8001), MongoDB (27018), Redis (6380), Qdrant (6337/6338)
133+ - ** Database:** ` test_db ` (separate from production)
134+ - ** Credentials:** ` test-admin@example.com ` / ` test-admin-password-123 `
149135
150- #### Test Separation by API Requirements
151-
152- Tests are separated into two categories:
153-
154- - ** No API Keys Required** (~ 70%): Endpoint tests, infrastructure tests, basic integration
155- - Uses ` configs/mock-services.yml `
156- - Runs on all PRs by default
157- - Fast CI feedback
158-
159- - ** API Keys Required** (~ 30%): Full E2E tests with transcription and memory extraction
160- - Uses ` configs/deepgram-openai.yml `
161- - Tagged with ` requires-api-keys `
162- - Runs on dev/main branches or when PR labeled with ` test-with-api-keys `
163-
164- #### Test Configuration Flags
165- - ** CLEANUP_CONTAINERS** (default: false): Automatically stop and remove test containers after test completion
166- - Set to ` true ` for cleanup: ` CLEANUP_CONTAINERS=true ./run-robot-tests.sh `
167- - ** CONFIG_FILE** : Choose test configuration
168- - ` configs/mock-services.yml ` - No API keys (default for run-no-api-tests.sh)
169- - ` configs/deepgram-openai.yml ` - With API keys (default for run-robot-tests.sh)
170- - ` configs/parakeet-ollama.yml ` - Fully local (no external APIs)
171-
172- #### Test Environment Variables
173- Tests use isolated test environment with overridden credentials:
174- - ** Test Database** : ` test_db ` (MongoDB on port 27018, separate from production)
175- - ** Test Ports** : Backend (8001), Qdrant (6337/6338), WebUI (3001)
176- - ** Test Credentials** :
177- - ` AUTH_SECRET_KEY ` : test-jwt-signing-key-for-integration-tests
178- - ` ADMIN_EMAIL ` : test-admin@example.com
179- - ` ADMIN_PASSWORD ` : test-admin-password-123
180- - ** API Keys** : Loaded from ` .env ` file (DEEPGRAM_API_KEY, OPENAI_API_KEY)
181- - ** Test Settings** : ` DISABLE_SPEAKER_RECOGNITION=true ` to prevent segment duplication
182-
183- #### Test Script Features
184- - ** Environment Compatibility** : Works with both local .env files and CI environment variables
185- - ** Isolated Test Environment** : Separate ports and database prevent conflicts with running services
186- - ** Automatic Cleanup** : Configurable via CLEANUP_CONTAINERS flag (default: false for faster re-runs)
187- - ** Colored Output** : Clear progress indicators and error reporting
188- - ** Timeout Protection** : 30-minute timeout for test execution
189- - ** Fresh Testing** : Clean database and containers for each test run
190- - ** API Key Separation** : Ability to run tests with or without external API dependencies
191-
192- #### GitHub Workflows
193-
194- ** Three workflows handle test execution:**
195-
196- 1 . ** ` robot-tests.yml ` ** - PR Tests (No API Keys)
197- - Triggers: All pull requests
198- - Execution: Excludes ` requires-api-keys ` tests (~ 70% of suite)
199- - No secrets required
200- - Fast feedback for contributors
201-
202- 2 . ** ` full-tests-with-api.yml ` ** - Dev/Main Tests (Full Suite)
203- - Triggers: Push to dev/main branches
204- - Execution: All tests including API-dependent (~ 100% of suite)
205- - Requires: DEEPGRAM_API_KEY, OPENAI_API_KEY
206- - Comprehensive validation before deployment
207-
208- 3 . ** ` pr-tests-with-api.yml ` ** - Label-Triggered PR Tests
209- - Triggers: PR with ` test-with-api-keys ` label
210- - Execution: Full test suite before merge
211- - Requires: DEEPGRAM_API_KEY, OPENAI_API_KEY
212- - Useful for testing API integration changes
136+ ** For complete test documentation, see ` tests/README.md ` **
213137
214138### Mobile App Development
215139``` bash
@@ -571,12 +495,11 @@ tailscale ip -4
571495- **Docker**: Primary deployment method with docker-compose
572496
573497# ## Testing Strategy
574- - **Local Test Scripts **: Simplified scripts (`./run-test.sh`) mirror CI workflows for local development
575- - **End-to-End Integration **: Robot Framework tests (`tests/integration/integration_test.robot`) validate complete audio processing pipeline
576- - **Speaker Recognition Tests **: `test_speaker_service_integration.py` validates speaker identification
498+ - **Makefile-Based **: All test operations through simple `make` commands (`make test`, `make start`, `make stop`)
499+ - **Log Preservation **: Container logs always saved before cleanup (never lose debugging info)
500+ - **End-to-End Integration **: Robot Framework validates complete audio processing pipeline
577501- **Environment Flexibility**: Tests work with both local .env files and CI environment variables
578- - **Automated Cleanup**: Test containers are automatically removed after execution
579- - **CI/CD Integration**: GitHub Actions use the same local test scripts for consistency
502+ - **CI/CD Integration**: Same test logic locally and in GitHub Actions
580503
581504# ## Code Style
582505- **Python**: Black formatter with 100-character line length, isort for imports
@@ -603,14 +526,10 @@ The system includes comprehensive health checks:
603526- Memory debug system for transcript processing monitoring
604527
605528# ## Integration Test Infrastructure
606- - **Unified Test Scripts**: Local `./run-test.sh` scripts mirror GitHub Actions workflows
607- - **Test Environment**: `docker-compose-test.yml` provides isolated services on separate ports
608- - **Test Database**: Uses `test_db` database with isolated collections
609- - **Service Ports**: Backend (8001), MongoDB (27018), Qdrant (6335/6336), WebUI (5174)
610- - **Test Credentials**: Auto-generated `.env.test` files with secure test configurations
611- - **Ground Truth**: Expected transcript established via `scripts/test_deepgram_direct.py`
612- - **AI Validation**: OpenAI-powered transcript similarity comparison
613- - **Test Audio**: 4-minute glass blowing tutorial (`extras/test-audios/DIY*mono*.wav`)
529+ - **Makefile Interface**: Simple `make` commands for all operations (see `tests/README.md`)
530+ - **Test Environment**: `docker-compose-test.yml` with isolated services on separate ports
531+ - **Test Database**: Uses `test_db` database (separate from production)
532+ - **Log Preservation**: All cleanup operations save logs to `tests/logs/` automatically
614533- **CI Compatibility**: Same test logic runs locally and in GitHub Actions
615534
616535# ## Cursor Rule Integration
0 commit comments