|
| 1 | +# Comprehensive Integration Test Script |
| 2 | + |
| 3 | +Validates all major API endpoints and functionality against a running Olla instance. Gives confidence there are no major regressions before release by auto-discovering backends and models to dynamically build the test matrix. |
| 4 | + |
| 5 | +## What It Tests |
| 6 | + |
| 7 | +The script runs nine phases covering every endpoint category: |
| 8 | + |
| 9 | +| Phase | Area | Tests | |
| 10 | +|-------|------|-------| |
| 11 | +| 1 | **Health Check** | Olla reachability gate | |
| 12 | +| 2 | **Internal/Monitoring** | `/internal/health`, `/internal/status`, endpoints, models, stats, process, `/version` | |
| 13 | +| 3 | **Unified Models** | `/olla/models` listing, `/olla/models/{id}` lookup | |
| 14 | +| 4 | **Proxy (OpenAI)** | Model list, non-streaming chat, streaming SSE, response headers | |
| 15 | +| 5 | **Anthropic Translator** | Model list, non-streaming/streaming messages, token counting, passthrough mode | |
| 16 | +| 6 | **Passthrough/Translation** | Mode validation per backend type, SSE event types, response structure, translator stats | |
| 17 | +| 7 | **Provider Routes** | Per-discovered-backend `/olla/{provider}/v1/models` | |
| 18 | +| 8 | **Response Headers** | Version structure, `X-Olla-Request-ID`, `X-Olla-Response-Time` | |
| 19 | +| 9 | **Error Handling** | Non-existent model, invalid body, missing model field | |
| 20 | +| 10 | **Summary** | Pass/fail totals grouped by phase | |
| 21 | + |
| 22 | +## Prerequisites |
| 23 | + |
| 24 | +- Python 3.8+ |
| 25 | +- Olla running with at least one healthy backend |
| 26 | +- Dependencies installed (`pip install -r ../requirements.txt`) |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +```bash |
| 31 | +# Run full test suite |
| 32 | +python test-integration.py |
| 33 | + |
| 34 | +# Custom Olla URL |
| 35 | +python test-integration.py --url http://localhost:8080 |
| 36 | + |
| 37 | +# Skip streaming tests (faster) |
| 38 | +python test-integration.py --skip-streaming |
| 39 | + |
| 40 | +# Skip Anthropic translator tests |
| 41 | +python test-integration.py --skip-anthropic |
| 42 | + |
| 43 | +# Skip provider-specific route tests |
| 44 | +python test-integration.py --skip-providers |
| 45 | + |
| 46 | +# Show response bodies |
| 47 | +python test-integration.py --verbose |
| 48 | + |
| 49 | +# Combine flags |
| 50 | +python test-integration.py --url http://myhost:40114 --timeout 60 --skip-streaming |
| 51 | +``` |
| 52 | + |
| 53 | +## CLI Arguments |
| 54 | + |
| 55 | +| Argument | Default | Description | |
| 56 | +|----------|---------|-------------| |
| 57 | +| `--url` | `http://localhost:40114` | Olla base URL | |
| 58 | +| `--timeout` | `30` | Request timeout in seconds | |
| 59 | +| `--skip-streaming` | off | Skip streaming tests | |
| 60 | +| `--skip-anthropic` | off | Skip Anthropic translator tests | |
| 61 | +| `--skip-providers` | off | Skip provider-specific route tests | |
| 62 | +| `--verbose` | off | Show response bodies | |
| 63 | + |
| 64 | +## Example Output |
| 65 | + |
| 66 | +``` |
| 67 | +======================================================================== |
| 68 | + Olla Comprehensive Integration Test |
| 69 | + Validates all major API endpoints and functionality |
| 70 | +======================================================================== |
| 71 | +
|
| 72 | +Phase 1: Health Check |
| 73 | +------------------------------------------------------------------------ |
| 74 | + [OK] Olla is reachable |
| 75 | +
|
| 76 | +Discovering endpoints and models... |
| 77 | + [OK] Found 3 endpoint(s) |
| 78 | + [OK] Found 5 model(s) |
| 79 | +
|
| 80 | +Phase 2: Internal/Monitoring Endpoints |
| 81 | +------------------------------------------------------------------------ |
| 82 | + [PASS] Health endpoint (/internal/health) |
| 83 | + [PASS] Status endpoint (/internal/status) |
| 84 | + [PASS] Endpoints status (/internal/status/endpoints) |
| 85 | + ... |
| 86 | +
|
| 87 | +======================================================================== |
| 88 | + Results Summary |
| 89 | +======================================================================== |
| 90 | + 8/8 Internal/Monitoring |
| 91 | + 2/2 Unified Models |
| 92 | + 4/4 Proxy (OpenAI) |
| 93 | + 5/5 Anthropic Translator |
| 94 | + 3/3 Provider Routes |
| 95 | + 2/2 Response Headers |
| 96 | + 3/3 Error Handling |
| 97 | +
|
| 98 | + Total: 27 | Passed: 27 | Failed: 0 |
| 99 | +
|
| 100 | + All tests passed. |
| 101 | +``` |
| 102 | + |
| 103 | +## Exit Codes |
| 104 | + |
| 105 | +| Code | Meaning | |
| 106 | +|------|---------| |
| 107 | +| `0` | All tests passed | |
| 108 | +| `1` | One or more tests failed, or Olla unreachable | |
| 109 | +| `130` | User interrupted (Ctrl+C) | |
0 commit comments