Run End-to-End Tests
E2E tests build a real Docker image from the current source, deploy it, and run the test suite against it. This validates the full binary, not just the in-process unit tests.
Architecture
- Custom sandbox:
e2e/custom-sandbox/— a Docker image that embeds the fullsandbox-apisource and builds it at image-build time - Simple custom sandbox:
e2e/simple-custom-sandbox/— a leaner image that takes a pre-compiled binary - Test scripts:
e2e/scripts/— Node.js tests run withnpm run test:local
Option 1: Full Local E2E (Build + Run + Test)
make e2e
This single command:
- Removes any existing
sandbox-devcontainer - Builds the custom sandbox image (
make build-custom-sandbox) - Starts the container (
make run-custom-sandbox) on ports 8080-8083 - Waits 5 seconds for startup
- Logs open file descriptors (leak detection)
- Runs the e2e test suite (
make test-custom-sandbox) - Logs file descriptors again after tests
Note: Watches for file descriptor leaks — the count before and after tests should not grow significantly.
Option 2: Step-by-Step
Build the Custom Sandbox Image
make build-custom-sandbox
Copies sandbox-api/ into e2e/custom-sandbox/ and builds custom-sandbox:latest.
Run It Locally
make run-custom-sandbox
Starts custom-sandbox:latest as sandbox-dev container with ports 8080-8083 exposed.
Run Tests Against It
make test-custom-sandbox
Runs e2e/scripts/npm run test:local against the running container.
Option 3: Deploy to Blaxel and Test
Deploy the custom sandbox to the Blaxel platform, wait for it to be DEPLOYED, then run tests:
make deploy-custom-sandbox
Then wait and test:
# This waits until status=DEPLOYED, then runs tests
# (embedded in make test-custom-sandbox)
make test-custom-sandbox
Option 4: Simple Custom Sandbox (Pre-Compiled Binary)
Compile for Linux first, then deploy:
make deploy-simple-custom-sandbox
This:
- Cross-compiles
sandbox-apiforlinux/amd64 - Copies the binary to
e2e/simple-custom-sandbox/ - Deploys to Blaxel with
bl deploy - Cleans up the binary
Useful for faster iteration when you don't need to rebuild the full Docker image.
Troubleshooting
- Build fails: Check
sandbox-api/compiles cleanly first withmake test - Container exits immediately: Run
docker logs sandbox-devto see the error - Tests fail with connection refused: Container may still be starting; increase the sleep or poll
/health - File descriptor count grows: There is a resource leak in the code path being tested — investigate with
lsof -p <pid>inside the container blcommand not found: Install the Blaxel CLI (brew install blaxel-ai/tap/blor equivalent)