This directory contains the comprehensive testing suite for AIBrix, including unit tests, integration tests, end-to-end tests, and performance regression testing.
test/
├── e2e/ # End-to-end tests against live clusters
│ ├── framework/ # Shared live-cluster test infrastructure
│ ├── gateway/ # Gateway API, routing, and PD tests
│ └── controller/ # Controller-owned lifecycle tests
├── integration/ # Integration tests using Ginkgo framework
├── regression/ # Performance regression tests for releases
├── utils/ # Shared test utilities and helpers
├── run-e2e-tests.sh # E2E test runner script
└── README.md # This file
- Write tests first - Add unit/integration tests for new features
- Run locally - Use
make testandmake test-integration - E2E validation - Run
make test-e2ebefore submitting changes
Note: Regression tests are run as part of the release process. You do not need to run them against every commit.
Unit tests are located alongside source code (*_test.go files), not in current test folder.
# Run all unit tests with coverage
make test
# Run tests for specific package
go test ./pkg/controller/...Integration tests use Ginkgo framework to test component interactions.
# Run all integration tests
make test-integration
# Run specific integration tests
make test-integration-controller
make test-integration-webhook
E2E tests validate complete AIBrix functionality against a running Kubernetes cluster.
For local development where cluster and AIBrix are already running:
Prerequisites for Development Mode:
- Kubernetes cluster is running and accessible
- AIBrix is deployed and healthy
# Development mode - run tests against existing setup
# make sure env `KUBECONFIG` is set correctly
make test-e2e
# Or run script directly
# Note: Required port-forwards should be active in this mode
go test -p 1 ./test/e2e/gateway/... ./test/e2e/controller/... -v -timeout 0For CI pipelines that need full cluster setup and teardown:
# Full CI setup - creates Kind cluster and installs AIBrix
KIND_E2E=true INSTALL_AIBRIX=true make test-e2e
or
./test/run-e2e-tests.shEnvironment Variables:
KIND_E2E=true- Creates Kind cluster with proper configurationINSTALL_AIBRIX=true- Builds images, installs dependencies, and deploys AIBrixAIBRIX_ROLESET_INPLACE_E2E=true- Runs RoleSet in-place update e2e tests and builds/loads their local test images whenINSTALL_AIBRIX=trueAIBRIX_ROLESET_INPLACE_E2E_KEEP_ON_FAILURE=true- Preserves RoleSet in-place e2e resources for debugging failed runsAIBRIX_E2E_SUITE=all|gateway|controller|gateway-pd- Selects the e2e suite; defaults toallAIBRIX_E2E_GATEWAY_URL,AIBRIX_E2E_NAMESPACE,AIBRIX_E2E_API_KEY,AIBRIX_E2E_GATEWAY_NAMESPACE- Override live-cluster e2e endpoints and namespacesAIBRIX_E2E_KEEP_RESOURCES_ON_FAILURE=true- Preserves installed e2e resources after a failed local runSKIP_KUBECTL_INSTALL=true- Skip kubectl installation (default: true)SKIP_KIND_INSTALL=true- Skip Kind installation (default: true)
The regression/ directory contains benchmark configurations for release testing:
- v0.2.1/: performance benchmark baseline
- v0.3.0/: KV cache variants
- v0.4.0/: Helm-based templates for SGLang/VLLM testing
Before each release, run performance benchmarks using configurations in regression/vX.Y.Z/:
- Deploy test configurations (YAML manifests or Helm charts)
- Run benchmark clients against different setups
- Collect and analyze performance metrics
- Compare against previous release baselines
See individual regression/*/README.md files for detailed benchmark procedures.
Tests are automatically executed in CI pipelines:
- Unit tests: Every commit
- Integration tests: Pull requests
- E2E tests: Nightly builds and releases