test(integration): reorganize test structure and add runner script

- Move integration tests and mock upstream resources from `integration/` to `test/` directory.
- Add `test/integration.sh` script to orchestrate environment setup and test execution.
- Update build context in `docker-compose.integration.yml` to match new structure.
- Add documentation for local development and integration testing workflows in README.
This commit is contained in:
zenfun
2025-12-02 15:56:17 +08:00
parent a0f13d55c1
commit d147f3ab04
8 changed files with 41 additions and 1 deletions

20
test/integration.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
# Runs integration tests inside the ez-api repo (builds docker-compose + go test).
REPO_ROOT=$(cd -- "$(dirname -- "$0")"/.. && pwd)
compose_file="$REPO_ROOT/docker-compose.integration.yml"
echo "[integration] bringing up services..."
docker compose -f "$compose_file" up --build -d --wait
cleanup() {
echo "[integration] tearing down services..."
docker compose -f "$compose_file" down -v
}
trap cleanup EXIT
echo "[integration] running go test with integration tag..."
cd "$REPO_ROOT/test"
go test -tags=integration ./...