mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
Add Docker-based test infrastructure for e2e tests (#424)
## Summary - Add `Dockerfile.test`: Python 3.12 image with Claude Code CLI installed - Add `scripts/test-docker.sh`: Local script to run tests in Docker - Add `test-e2e-docker` job to CI workflow that runs the full e2e suite in a container - Add `.dockerignore` to speed up Docker builds ## Context This helps catch Docker-specific issues like #406 where filesystem-based agents loaded via `setting_sources=["project"]` may silently fail in Docker environments. ## Local Usage ```bash # Run unit tests in Docker (no API key needed) ./scripts/test-docker.sh unit # Run e2e tests in Docker ANTHROPIC_API_KEY=sk-... ./scripts/test-docker.sh e2e # Run all tests ANTHROPIC_API_KEY=sk-... ./scripts/test-docker.sh all ``` ## Test plan - [x] Unit tests pass in Docker locally (129 passed) - [ ] CI job runs successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
904c2ec33c
commit
a0ce44a3fa
7 changed files with 381 additions and 19 deletions
18
.github/workflows/test.yml
vendored
18
.github/workflows/test.yml
vendored
|
|
@ -81,6 +81,24 @@ jobs:
|
|||
run: |
|
||||
python -m pytest e2e-tests/ -v -m e2e
|
||||
|
||||
test-e2e-docker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test # Run after unit tests pass
|
||||
# Run e2e tests in Docker to catch container-specific issues like #406
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker test image
|
||||
run: docker build -f Dockerfile.test -t claude-sdk-test .
|
||||
|
||||
- name: Run e2e tests in Docker
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
run: |
|
||||
docker run --rm -e ANTHROPIC_API_KEY \
|
||||
claude-sdk-test python -m pytest e2e-tests/ -v -m e2e
|
||||
|
||||
test-examples:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-e2e # Run after e2e tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue