|
| 1 | +# vLLM Dockerfile Tests |
| 2 | + |
| 3 | +Validates that the vLLM Docker environment builds correctly and contains all required components. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This test suite ensures the vLLM Dockerfile: |
| 8 | +- ✅ Builds successfully without errors |
| 9 | +- ✅ Contains required components (Python 3.12, vLLM dependencies) |
| 10 | +- ✅ Runs with proper security (non-root user) |
| 11 | + |
| 12 | +## Test Structure |
| 13 | + |
| 14 | +``` |
| 15 | +test_vllm/ |
| 16 | +├── test_dockerfile.py # 3 tests |
| 17 | +└── README.md # This file |
| 18 | +``` |
| 19 | + |
| 20 | +### Tests |
| 21 | + |
| 22 | +**TestVLLMDockerBuild** - 3 comprehensive tests (requires Docker): |
| 23 | + |
| 24 | +1. `test_image_builds_successfully` - Validates Docker build completes |
| 25 | +2. `test_image_has_required_components` - Verifies Python 3.12, virtualenv, paths |
| 26 | +3. `test_container_runs_as_non_root` - Security validation (uid 1000) |
| 27 | + |
| 28 | +## Running Tests |
| 29 | + |
| 30 | +### As Part of All Functional Tests (Recommended): |
| 31 | +```bash |
| 32 | +make functional-tests # Runs all functional tests including vLLM |
| 33 | +``` |
| 34 | + |
| 35 | +### Directly with pytest: |
| 36 | +```bash |
| 37 | +# Run only vLLM tests |
| 38 | +pytest tests/functional/test_vllm/test_dockerfile.py -v |
| 39 | + |
| 40 | +# Or as part of all functional tests |
| 41 | +pytest tests/functional/ -v |
| 42 | +``` |
| 43 | + |
| 44 | +## CI/CD Integration |
| 45 | + |
| 46 | +### Jenkins |
| 47 | +```groovy |
| 48 | +stage('Test vLLM') { |
| 49 | + steps { |
| 50 | + sh 'pytest tests/functional/test_vllm/test_dockerfile.py -v' |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +### GitHub Actions |
| 56 | +```yaml |
| 57 | +- name: Test vLLM Dockerfile |
| 58 | + run: pytest tests/functional/test_vllm/test_dockerfile.py -v |
| 59 | +``` |
| 60 | +
|
| 61 | +### GitLab CI |
| 62 | +```yaml |
| 63 | +test:vllm: |
| 64 | + script: |
| 65 | + - pytest tests/functional/test_vllm/test_dockerfile.py -v |
| 66 | +``` |
| 67 | +
|
| 68 | +## Performance |
| 69 | +
|
| 70 | +| Run Type | Time | |
| 71 | +|----------|------| |
| 72 | +| First run (with image download) | 5-15 min | |
| 73 | +| Cached run | 3-5 min | |
| 74 | +
|
| 75 | +The Docker image is built once and reused across all tests in the class. |
| 76 | +
|
| 77 | +## Requirements |
| 78 | +
|
| 79 | +### On Your Host Machine (to run tests): |
| 80 | +- Docker daemon running |
| 81 | +- Python 3.8+ (for pytest test runner) |
| 82 | +- pytest, docker Python packages |
| 83 | +
|
| 84 | +### Inside the Docker Container (what gets tested): |
| 85 | +- Python 3.12 (installed by Dockerfile) |
| 86 | +- vLLM dependencies (from base image) |
| 87 | +- ~15GB free disk space for image |
| 88 | +
|
| 89 | +## Troubleshooting |
| 90 | +
|
| 91 | +### Docker not running: |
| 92 | +```bash |
| 93 | +# Error: "Docker is not available or accessible" |
| 94 | +# Solution: |
| 95 | +# macOS/Windows: Start Docker Desktop |
| 96 | +# Linux: sudo systemctl start docker |
| 97 | +``` |
| 98 | + |
| 99 | +### Insufficient disk space: |
| 100 | +```bash |
| 101 | +# Error: "no space left on device" |
| 102 | +# Solution: |
| 103 | +docker system prune -a # Remove unused images |
| 104 | +docker images # Check current images |
| 105 | +df -h # Check disk space |
| 106 | +``` |
| 107 | + |
| 108 | +### Build fails - Base image unavailable: |
| 109 | +```bash |
| 110 | +# Error: "pull access denied" or "manifest unknown" |
| 111 | +# Context: Image pulled from Docker Hub: vllm/vllm-openai:v0.11.0 |
| 112 | +# Solution: |
| 113 | +# 1. Check internet connection |
| 114 | +# 2. Verify base image exists: docker pull vllm/vllm-openai:v0.11.0 |
| 115 | +# 3. If behind corporate proxy, configure Docker proxy settings |
| 116 | +# 4. If authentication required, login: docker login |
| 117 | +``` |
| 118 | + |
| 119 | +### Build fails - Authentication required: |
| 120 | +```bash |
| 121 | +# Error: "pull access denied for vllm/vllm-openai" with "authentication required" |
| 122 | +# Solution: |
| 123 | +# 1. Login to Docker Hub: docker login |
| 124 | +# 2. Or use credentials: docker login -u <username> -p <password> |
| 125 | +# 3. If using private registry, configure credentials in Docker config |
| 126 | +``` |
| 127 | + |
| 128 | +### Build fails - Dependency installation: |
| 129 | +```bash |
| 130 | +# Error: "E: Unable to locate package python3.12" |
| 131 | +# Context: Dockerfile specifies Python 3.12 installation (line 4) |
| 132 | +# Solution: |
| 133 | +# 1. Verify base image hasn't changed: docker pull vllm/vllm-openai:v0.11.0 |
| 134 | +# 2. Check if Dockerfile was modified in public_dropin_gpu_environments/vllm/ |
| 135 | +# 3. Try rebuilding without cache: docker build --no-cache |
| 136 | +``` |
| 137 | + |
| 138 | +### Container fails to start: |
| 139 | +```bash |
| 140 | +# Error: "Container did not start in time" |
| 141 | +# Solution: |
| 142 | +# 1. Check Docker daemon logs: docker logs <container-id> |
| 143 | +# 2. Verify sufficient resources (CPU/memory) |
| 144 | +# 3. Check for port conflicts |
| 145 | +``` |
| 146 | + |
| 147 | + |
| 148 | +## Design Philosophy |
| 149 | + |
| 150 | +These tests follow best practices: |
| 151 | +- **No redundancy**: Each test validates something unique |
| 152 | +- **Fast feedback**: Docker build happens once, reused across tests |
| 153 | +- **CI-friendly**: Integrates seamlessly with existing test infrastructure |
| 154 | +- **Clear failures**: Detailed error messages for debugging |
| 155 | + |
| 156 | + |
0 commit comments