Files
copilotkit__copilotkit/showcase/scripts/smoke-local.sh
Jordan Ritter 44622440fe feat(showcase): add local smoke target (aimock + 17 packages in Docker)
Wires up a single-command path to run the full integration smoke suite
against a local Docker stack instead of Railway. Useful when Railway is
degraded (OOM, rate limits) or when testing changes that haven't been
deployed yet.

Additions:
- showcase/docker-compose.local.yml: add `aimock` as 18th service so
  integration containers can reach http://aimock:4010 on the compose
  network, mirroring the Railway setup where they call showcase-aimock.
- showcase/tests/e2e/integration-smoke.spec.ts: `LOCAL_PORTS=1` env
  rewrites each integration's Railway URL to http://localhost:<port>
  via showcase/shared/local-ports.json. Starters are skipped under this
  flag because they aren't in local-ports.json.
- showcase/scripts/smoke-local.sh: orchestrates build → up → wait → run
  Playwright → tear down. Supports --level=L1/L2/L3/L4, --keep, --no-build.
- showcase/tests/package.json: `pnpm smoke:local[:L1|:keep|:nobuild]`
  scripts delegate to the helper.
- showcase/.env.example: document optional OPENAI_BASE_URL +
  ANTHROPIC_BASE_URL (route through local aimock) and package-specific
  GitHubToken + GOOGLE_API_KEY (ms-agent-dotnet, google-adk).

Verified locally: `pnpm smoke:local:L1` → 17/17 L1 green against the
local stack.
2026-04-18 15:56:19 -07:00

68 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# End-to-end local smoke: bring up aimock + 17 showcase packages in Docker,
# wait for health, run the integration-smoke Playwright suite against localhost,
# print a pass/fail summary.
#
# Usage:
# scripts/smoke-local.sh # L1-L4 all levels
# scripts/smoke-local.sh --level=L1 # single level (L1/L2/L3/L4)
# scripts/smoke-local.sh --keep # leave containers running after
# scripts/smoke-local.sh --no-build # assume images already built
#
# Prereqs: showcase/.env exists (copy from showcase/.env.example). Docker
# daemon running. `pnpm install` in showcase/tests has been run once.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SHOWCASE_DIR="$(dirname "$HERE")"
LEVEL=""
KEEP=0
NO_BUILD=0
for arg in "$@"; do
case "$arg" in
--level=L1) LEVEL="@health" ;;
--level=L2) LEVEL="@agent" ;;
--level=L3) LEVEL="@chat" ;;
--level=L4) LEVEL="@tools" ;;
--keep) KEEP=1 ;;
--no-build) NO_BUILD=1 ;;
-h|--help) sed -n '2,15p' "${BASH_SOURCE[0]}"; exit 0 ;;
*) echo "unknown arg: $arg" >&2; exit 2 ;;
esac
done
if [ ! -f "$SHOWCASE_DIR/.env" ]; then
echo "[smoke-local] Missing showcase/.env. Copy .env.example and fill in keys." >&2
exit 1
fi
if [ "$NO_BUILD" = "0" ]; then
echo "[smoke-local] Building + starting 18 containers (aimock + 17 packages)..."
"$HERE/dev-local.sh" up
else
echo "[smoke-local] --no-build: assuming images present; starting containers..."
docker compose -f "$SHOWCASE_DIR/docker-compose.local.yml" up -d
fi
echo "[smoke-local] Waiting 20s for containers to warm..."
sleep 20
GREP_ARG=("--grep" "${LEVEL:-@health|@agent|@chat|@tools}")
GREP_ARG+=("--grep-invert" "@starter")
cd "$SHOWCASE_DIR/tests"
EXIT=0
LOCAL_PORTS=1 SMOKE_ALL=true npx playwright test integration-smoke \
"${GREP_ARG[@]}" --reporter=list || EXIT=$?
if [ "$KEEP" = "0" ]; then
echo "[smoke-local] Tearing down..."
"$HERE/dev-local.sh" down
else
echo "[smoke-local] --keep: containers left running."
fi
exit "$EXIT"