Add Docker-based test infrastructure for e2e tests

Add Docker test infrastructure to catch container-specific issues like #406
where filesystem-based agents may silently fail in Docker environments.

Changes:
- 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
- Add .dockerignore to speed up Docker builds

Usage:
  ./scripts/test-docker.sh unit    # Run unit tests in Docker
  ./scripts/test-docker.sh e2e     # Run e2e tests (needs ANTHROPIC_API_KEY)
  ./scripts/test-docker.sh all     # Run all tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ashwin Bhat 2025-12-16 10:00:43 -08:00
parent 5637ab7d0e
commit d8c0af94ee
No known key found for this signature in database
4 changed files with 173 additions and 0 deletions

View file

@ -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