test(integration): add e2e testing suite and infrastructure

Introduces a comprehensive integration testing setup and local development environment.

Changes include:
- Add `docker-compose.yml` for local stack orchestration.
- Add `docker-compose.integration.yml` for the integration test environment.
- Create `mock-upstream` service to simulate external LLM provider responses.
- Implement Go-based end-to-end tests verifying control plane configuration and data plane routing.
- Add `integration_test.sh` for quick connectivity verification.
This commit is contained in:
zenfun
2025-12-02 14:47:01 +08:00
parent aa57af874c
commit f56f9215d8
7 changed files with 393 additions and 13 deletions

View File

@@ -1,12 +1,16 @@
version: "3.8"
services:
# 1. PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: ez-postgres
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-ezapi}
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
@@ -22,6 +26,8 @@ services:
image: redis:7-alpine
container_name: ez-redis
command: redis-server --appendonly yes
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
@@ -39,13 +45,13 @@ services:
dockerfile: Dockerfile
container_name: ez-api
ports:
- "${EZ_API_PORT}:${EZ_API_PORT}"
- "${EZ_API_PORT:-8080}:8080"
environment:
EZ_API_PORT: ${EZ_API_PORT}
EZ_PG_DSN: ${EZ_PG_DSN}
EZ_REDIS_ADDR: ${EZ_REDIS_ADDR}
EZ_API_PORT: ${EZ_API_PORT:-8080}
EZ_PG_DSN: ${EZ_PG_DSN:-host=postgres user=postgres password=postgres dbname=ezapi port=5432 sslmode=disable}
EZ_REDIS_ADDR: ${EZ_REDIS_ADDR:-redis:6379}
EZ_REDIS_PASSWORD: ${EZ_REDIS_PASSWORD}
EZ_REDIS_DB: ${EZ_REDIS_DB}
EZ_REDIS_DB: ${EZ_REDIS_DB:-0}
depends_on:
postgres:
condition: service_healthy
@@ -61,12 +67,12 @@ services:
dockerfile: Dockerfile
container_name: ez-balancer
ports:
- "${EZ_BALANCER_PORT}:${EZ_BALANCER_PORT}"
- "${EZ_BALANCER_PORT:-8081}:8081"
environment:
EZ_BALANCER_PORT: ${EZ_BALANCER_PORT}
EZ_REDIS_ADDR: ${EZ_REDIS_ADDR}
EZ_BALANCER_PORT: ${EZ_BALANCER_PORT:-8081}
EZ_REDIS_ADDR: ${EZ_REDIS_ADDR:-redis:6379}
EZ_REDIS_PASSWORD: ${EZ_REDIS_PASSWORD}
EZ_REDIS_DB: ${EZ_REDIS_DB}
EZ_REDIS_DB: ${EZ_REDIS_DB:-0}
depends_on:
redis:
condition: service_healthy
@@ -79,4 +85,4 @@ volumes:
networks:
ez-network:
driver: bridge
driver: bridge