forked from stripe/sync-engine
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtest-devcontainer.sh
More file actions
executable file
·73 lines (57 loc) · 1.79 KB
/
test-devcontainer.sh
File metadata and controls
executable file
·73 lines (57 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# Validation script for the dev container setup.
# Run inside the dev container to verify all services are reachable
# and the development toolchain is functional.
#
# Usage: bash .devcontainer/test-devcontainer.sh
set -euo pipefail
PASS=0
FAIL=0
check() {
local label="$1"
shift
if "$@" >/dev/null 2>&1; then
echo " PASS $label"
((PASS++))
else
echo " FAIL $label"
((FAIL++))
fi
}
echo "=== Dev Container Validation ==="
echo ""
# --- Toolchain ---
echo "Toolchain:"
check "Node.js >= 24" node -e "assert(parseInt(process.versions.node) >= 24)"
check "pnpm available" pnpm --version
check "TypeScript available" pnpm exec tsc --version
check "corepack enabled" corepack --version
echo ""
# --- Service connectivity ---
echo "Services:"
check "Postgres (postgres:5432)" pg_isready -h postgres -p 5432 -U postgres
check "stripe-mock (stripe-mock:12111)" nc -z stripe-mock 12111
check "Temporal gRPC (temporal:7233)" nc -z temporal 7233
echo ""
# --- Database ---
echo "Database:"
check "Postgres connection" psql "$DATABASE_URL" -c "SELECT 1"
check "stripe schema" psql "$POSTGRES_URL" -c "CREATE SCHEMA IF NOT EXISTS stripe"
echo ""
# --- Stripe mock ---
echo "Stripe Mock:"
check "GET /v1/customers" curl -sf -H "Authorization: Bearer sk_test_fake123" http://stripe-mock:12111/v1/customers
echo ""
# --- Build artifacts ---
echo "Build:"
check "node_modules exists" test -d node_modules
check "Build output exists" test -d packages/protocol/dist
echo ""
# --- Environment variables ---
echo "Environment:"
check "DATABASE_URL set" test -n "${DATABASE_URL:-}"
check "STRIPE_MOCK_URL set" test -n "${STRIPE_MOCK_URL:-}"
check "TEMPORAL_ADDRESS set" test -n "${TEMPORAL_ADDRESS:-}"
echo ""
echo "=== Results: $PASS passed, $FAIL failed ==="
[ "$FAIL" -eq 0 ] || exit 1