This guide covers running and debugging tests for the caching proxy.
# Full test suite via Helm (recommended)
mage all
# E2E tests with local debugging (mirrord)
mage test:clusterNote:
mage allsets up the complete environment (cluster, images, deployment) and ends by invokinghelm test caching --timeout=15m. It runs unit tests and Helm-driven tests — it does not runmage test:cluster(mirrord E2E).
When running helm test directly (not through mage all), you must specify a timeout of at least 420 seconds:
helm test caching --timeout=420sTest and mirrord resources run in test.namespace (caching-test by default), independently of the proxy namespaces. The test pod receives SQUID_NAMESPACE and NGINX_NAMESPACE, so either proxy can be deployed in a separate namespace or disabled. For an Nginx-only run:
helm upgrade --install caching ./caching \
--set squid.enabled=false --set nginx.enabled=true \
--set test.labelFilter=nginx
helm test caching --timeout=420sThe default Helm test timeout is 5 minutes (300 seconds), which may not be sufficient for all tests to complete.
For local development and debugging, use mirrord to run tests with cluster network access:
# Setup test environment first
mage cachingHelm:up
# Run tests with cluster network access
mage test:cluster
# Run with multiple replicas
mage test:clusterMultiReplicaThis uses mirrord to "steal" network connections from a target pod and runs the test locally (outside of the Kind cluster) with Ginkgo. This allows for local debugging without rebuilding test containers.
Use the GINKGO_LABEL_FILTER environment variable to control which tests run:
# Skip tests with external dependencies (via Helm)
GINKGO_LABEL_FILTER='!external-deps' mage all
# Skip tests with external dependencies (via mirrord)
GINKGO_LABEL_FILTER='!external-deps' mage test:clusterFor syntax details, see the Ginkgo label-filter documentation.
The repository includes complete VS Code configuration for Ginkgo testing.
Use VS Code's debug panel (F5) to run tests with breakpoints:
| Configuration | Description |
|---|---|
| Debug Ginkgo E2E Tests | Run all E2E tests with debugging |
| Debug Ginkgo Tests (Current File) | Debug tests in the currently open file |
| Run Ginkgo Tests with Coverage | Generate test coverage reports |
Available via Ctrl+Shift+P → "Tasks: Run Task":
| Task | Description |
|---|---|
| Setup Test Environment | Runs mage all to prepare everything |
| Run Ginkgo E2E Tests | Run E2E tests locally with Ginkgo + mirrord |
| Run Ginkgo Tests (Current Directory) | Run tests in the currently open directory |
| Run Ginkgo Tests with Coverage | Generate test coverage reports |
| Run Focused Ginkgo Tests | Run specific test patterns |
| Check Test Environment Status | Run mage kind:status && mage cachingHelm:status |
| Generate Ginkgo Test File | Bootstrap a new Ginkgo test file |
| Clean Test Environment | Clean up all resources |
When adding new tests:
- Use test helpers: Leverage
tests/testhelpers/for common operations - Follow Ginkgo patterns: Use
Describe,Context,Itfor clear test structure - Add cache-busting: Use unique URLs to prevent test interference
- Verify cleanup: Ensure tests clean up resources properly
- Update VS Code config: Add debug configurations for new test files
| Command | Description |
|---|---|
mage test:unit |
Run unit tests (no cluster required) |
mage test:cluster |
Run E2E tests with mirrord |
mage test:clusterMultiReplica |
Run E2E tests with multiple replicas |
For all available commands, run mage -l.