Skip to content

Commit f784352

Browse files
authored
uv: update lock (#25)
1 parent 21a0429 commit f784352

File tree

5 files changed

+1678
-1601
lines changed

5 files changed

+1678
-1601
lines changed

.github/workflows/test-emulators.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ jobs:
3636
run: |
3737
uv sync --all-extras --frozen
3838
39+
- name: Clean up any existing Docker volumes
40+
run: docker compose down -v || true
41+
3942
- name: Pre-build selected images (incl. Postgres 18)
4043
run: bash scripts/prebuild-images.sh a2a-inspector firebase-emulator postgres
4144

4245
- name: Start Docker Compose services
4346
run: bash scripts/start-services.sh --no-build
4447

4548
- name: Wait for services to be ready
46-
run: bash scripts/wait-for-services.sh --default 60 --a2a 180
49+
run: bash scripts/wait-for-services.sh --default 90 --a2a 180 --postgres 150
4750

4851
- name: Run unit/integration tests (non-e2e)
4952
run: bash scripts/run-tests-fast.sh

docker-compose.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ services:
255255
- cli # Only run when explicitly requested
256256

257257
# PostgreSQL 18 (pure Postgres)
258+
# Note: PG 18+ uses major-version-specific directories (e.g., /var/lib/postgresql/18/data)
259+
# Mount at /var/lib/postgresql (not /data subdir) for pg_upgrade compatibility.
258260
postgres:
259261
build:
260262
context: ./postgres
@@ -266,8 +268,9 @@ services:
266268
- POSTGRES_USER=postgres
267269
- POSTGRES_PASSWORD=password
268270
- POSTGRES_DB=postgres
271+
# PGDATA is automatically set to /var/lib/postgresql/18/data by the image
269272
volumes:
270-
- postgres_data:/var/lib/postgresql/data
273+
- postgres_data:/var/lib/postgresql
271274
healthcheck:
272275
test: ["CMD", "pg_isready", "-U", "postgres"]
273276
interval: 30s

justfile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ lint path='tests/' opts='--fix':
9797
# ---- WRKFLW helpers ----
9898

9999
# Validate workflows with wrkflw
100+
[group("wrkflw")]
100101
gh-validate target='':
101102
@if ! command -v wrkflw >/dev/null 2>&1; then \
102103
echo '❌ wrkflw not found.'; \
@@ -112,6 +113,7 @@ gh-validate target='':
112113
fi
113114

114115
# Run a workflow locally with wrkflw
116+
[group("wrkflw")]
115117
gh-run file='.github/workflows/test-emulators.yaml' runtime='docker' verbose='true' preserve='':
116118
@if ! command -v wrkflw >/dev/null 2>&1; then \
117119
echo '❌ wrkflw not found.'; \
@@ -130,20 +132,8 @@ gh-run file='.github/workflows/test-emulators.yaml' runtime='docker' verbose='tr
130132
echo '▶️ Running:' "${cmd[@]}"; \
131133
"${cmd[@]}"
132134

133-
# Open wrkflw TUI for workflows
134-
gh-tui target='.github/workflows' runtime='':
135-
@if ! command -v wrkflw >/dev/null 2>&1; then \
136-
echo '❌ wrkflw not found.'; \
137-
echo ' Install with: cargo install wrkflw'; \
138-
exit 127; \
139-
fi
140-
@set -e; \
141-
cmd=(wrkflw tui "{{target}}"); \
142-
if [ -n "{{runtime}}" ]; then cmd+=(--runtime "{{runtime}}"); fi; \
143-
echo '🖥️ TUI:' "${cmd[@]}"; \
144-
"${cmd[@]}"
145-
146135
# Check wrkflw availability and show version
136+
[group("wrkflw")]
147137
gh-check:
148138
@if command -v wrkflw >/dev/null 2>&1; then \
149139
echo '✅ wrkflw installed:'; wrkflw --version || wrkflw -V || true; \

scripts/wait-for-services.sh

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,36 @@
22
set -euo pipefail
33

44
# Idempotent waiter for emulator services.
5-
# Usage: bash scripts/wait-for-services.sh [--default <sec>] [--a2a <sec>]
5+
# Usage: bash scripts/wait-for-services.sh [--default <sec>] [--a2a <sec>] [--postgres <sec>]
66

77
DEFAULT_WAIT=60
88
A2A_WAIT=180
9+
POSTGRES_WAIT=""
910

1011
while [[ $# -gt 0 ]]; do
1112
case "$1" in
1213
--default)
1314
DEFAULT_WAIT="${2:-60}"; shift 2 ;;
1415
--a2a)
1516
A2A_WAIT="${2:-180}"; shift 2 ;;
17+
--postgres)
18+
POSTGRES_WAIT="${2:-120}"; shift 2 ;;
1619
*)
1720
echo "Unknown argument: $1" >&2; exit 2 ;;
1821
esac
1922
done
2023

24+
# Use POSTGRES_WAIT if set, otherwise use DEFAULT_WAIT
25+
POSTGRES_WAIT="${POSTGRES_WAIT:-$DEFAULT_WAIT}"
26+
2127
echo "Waiting for emulator services..."
2228

2329
wait_http() {
2430
local name="$1"; shift
2531
local url="$1"; shift
2632
local max="${1:-$DEFAULT_WAIT}"
2733
echo "- Waiting for ${name} at ${url}"
28-
for i in $(seq 1 "$max"); do
34+
for _ in $(seq 1 "$max"); do
2935
local code
3036
code=$(curl -s -o /dev/null -w "%{http_code}" "$url" || true)
3137
if [[ "$code" =~ ^2|3 ]]; then
@@ -44,8 +50,8 @@ wait_tcp() {
4450
local port="$1"; shift
4551
local max="${1:-$DEFAULT_WAIT}"
4652
echo "- Waiting for ${name} at ${host}:${port}"
47-
for i in $(seq 1 "$max"); do
48-
if (echo > /dev/tcp/${host}/${port}) >/dev/null 2>&1; then
53+
for _ in $(seq 1 "$max"); do
54+
if (echo > "/dev/tcp/${host}/${port}") >/dev/null 2>&1; then
4955
echo " ${name} is ready"
5056
return 0
5157
fi
@@ -55,6 +61,63 @@ wait_tcp() {
5561
return 1
5662
}
5763

64+
wait_postgres() {
65+
local name="$1"; shift
66+
local host="$1"; shift
67+
local port="$1"; shift
68+
local max="${1:-$DEFAULT_WAIT}"
69+
echo "- Waiting for ${name} at ${host}:${port}"
70+
71+
local restart_count=0
72+
for _ in $(seq 1 "$max"); do
73+
# Check container status
74+
local container_status
75+
container_status=$(docker inspect -f '{{.State.Status}}' postgres-18 2>/dev/null || echo "not-found")
76+
77+
case "$container_status" in
78+
"running")
79+
# Container is running, check if PostgreSQL is ready
80+
if docker exec postgres-18 pg_isready -U postgres >/dev/null 2>&1; then
81+
echo " ${name} is ready"
82+
return 0
83+
fi
84+
restart_count=0
85+
;;
86+
"restarting")
87+
restart_count=$((restart_count + 1))
88+
if [[ $restart_count -ge 5 ]]; then
89+
echo " ERROR: ${name} is in restart loop" >&2
90+
echo " Container logs (last 30 lines):" >&2
91+
docker logs postgres-18 --tail 30 2>&1 >&2 || true
92+
return 1
93+
fi
94+
;;
95+
"exited"|"dead")
96+
echo " ERROR: ${name} container has stopped (status: ${container_status})" >&2
97+
echo " Container logs (last 30 lines):" >&2
98+
docker logs postgres-18 --tail 30 2>&1 >&2 || true
99+
return 1
100+
;;
101+
"not-found")
102+
echo " ERROR: postgres-18 container not found" >&2
103+
docker ps --all --filter "name=postgres-18" >&2
104+
return 1
105+
;;
106+
esac
107+
108+
sleep 2
109+
done
110+
111+
# Debug: show final state
112+
echo " ERROR: ${name} not ready in time" >&2
113+
echo " Container status: $(docker inspect -f '{{.State.Status}}' postgres-18 2>/dev/null || echo 'unknown')" >&2
114+
echo " Last pg_isready output:" >&2
115+
docker exec postgres-18 pg_isready -U postgres 2>&1 >&2 || true
116+
echo " Container logs (last 30 lines):" >&2
117+
docker logs postgres-18 --tail 30 2>&1 >&2 || true
118+
return 1
119+
}
120+
58121
wait_http "Firebase UI" "http://localhost:4000" "$DEFAULT_WAIT"
59122
wait_http "Elasticsearch" "http://localhost:9200/_cluster/health" "$DEFAULT_WAIT"
60123
wait_http "Qdrant" "http://localhost:6333/healthz" "$DEFAULT_WAIT"
@@ -65,6 +128,6 @@ wait_http "MLflow" "http://localhost:5252/" "$DEFAULT_WAIT"
65128
wait_tcp "Spanner gRPC" localhost 9010 "$DEFAULT_WAIT"
66129
wait_tcp "pgAdapter" localhost "${PGADAPTER_PORT:-55432}" "$DEFAULT_WAIT"
67130
wait_tcp "Bigtable Emulator" localhost 8086 "$DEFAULT_WAIT"
68-
wait_tcp "PostgreSQL 18" localhost "${POSTGRES_PORT:-5433}" "$DEFAULT_WAIT"
131+
wait_postgres "PostgreSQL 18" localhost "${POSTGRES_PORT:-5433}" "$POSTGRES_WAIT"
69132

70133
echo "All targeted services reported ready."

0 commit comments

Comments
 (0)