Skip to content

Commit 01b2c11

Browse files
author
Shane Wall
committed
demo/postgres-survive-kill9/ci-smoke.sh now waits for the metrics endpoint and diffkeeper_recovery_total (up to ~4 minutes), both before and after the kill/restart. This prevents the curl/grep from failing when metrics aren’t up yet.
1 parent 18bcab9 commit 01b2c11

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎demo/postgres-survive-kill9/ci-smoke.sh‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,22 @@ wait_pgbench_tables() {
3737
exit 1
3838
}
3939

40+
wait_metrics() {
41+
echo "Waiting for metrics endpoint..."
42+
for _ in {1..120}; do
43+
if curl -sf http://localhost:9911/metrics | grep -q diffkeeper_recovery_total; then
44+
return
45+
fi
46+
sleep 2
47+
done
48+
echo "Metrics endpoint did not respond with diffkeeper_recovery_total" >&2
49+
exit 1
50+
}
51+
4052
docker compose up -d
4153
wait_pg
4254
wait_pgbench_tables
55+
wait_metrics
4356

4457
baseline=$(docker compose exec -T postgres psql -U postgres -d bench -t -A -c "SELECT count(*) FROM pgbench_history;" 2>/dev/null || echo "0")
4558
echo "Baseline transactions: ${baseline}"
@@ -50,6 +63,7 @@ echo "Waiting for Postgres to restart..."
5063
docker compose up -d --force-recreate postgres >/dev/null 2>&1
5164
wait_pg
5265
wait_pgbench_tables
66+
wait_metrics
5367

5468
after=$(docker compose exec -T postgres psql -U postgres -d bench -t -A -c "SELECT count(*) FROM pgbench_history;" 2>/dev/null || echo "0")
5569
echo "Post-restart transactions: ${after}"
@@ -58,5 +72,4 @@ if (( after < baseline )); then
5872
exit 1
5973
fi
6074

61-
curl -sf http://localhost:9911/metrics | grep diffkeeper_recovery_total
6275
echo "CI smoke test: PASS"

0 commit comments

Comments
 (0)