@@ -74,22 +74,35 @@ jobs:
7474 start-single-node --insecure --listen-addr=0.0.0.0:26257 --http-addr=0.0.0.0:8080
7575
7676 echo "Waiting for PostgreSQL..."
77+ pg_ok=0
7778 for i in {1..30}; do
7879 if PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -c "SELECT 1" >/dev/null 2>&1; then
7980 echo "PostgreSQL is up."
81+ pg_ok=1
8082 break
8183 fi
8284 sleep 2
8385 done
86+ if [ "$pg_ok" -ne 1 ]; then
87+ echo "PostgreSQL did not become ready in time."
88+ exit 1
89+ fi
8490
8591 echo "Waiting for CockroachDB..."
92+ crdb_ok=0
8693 for i in {1..30}; do
8794 if docker exec crdb cockroach sql --host=localhost:26257 --insecure -e "SELECT 1" >/dev/null 2>&1; then
8895 echo "CockroachDB is up."
96+ crdb_ok=1
8997 break
9098 fi
9199 sleep 2
92100 done
101+ if [ "$crdb_ok" -ne 1 ]; then
102+ echo "CockroachDB did not become ready in time. Container logs:"
103+ docker logs crdb || true
104+ exit 1
105+ fi
93106
94107 - name : Smoke test startup with PostgreSQL
95108 run : |
@@ -101,13 +114,19 @@ jobs:
101114 ../target/release/hulykvs &
102115 SERVER_PID=$!
103116
117+ ok=0
104118 for i in {1..30}; do
105119 if curl -fsS http://localhost:8094/status >/dev/null 2>&1; then
106120 echo "hulykvs started successfully with PostgreSQL."
121+ ok=1
107122 break
108123 fi
109124 sleep 2
110125 done
126+ if [ "$ok" -ne 1 ]; then
127+ echo "hulykvs did not start successfully with PostgreSQL (no /status response)."
128+ exit 1
129+ fi
111130
112131 kill "$SERVER_PID" || true
113132 wait "$SERVER_PID" || true
@@ -123,13 +142,19 @@ jobs:
123142 ../target/release/hulykvs &
124143 SERVER_PID=$!
125144
145+ ok=0
126146 for i in {1..30}; do
127147 if curl -fsS http://localhost:8094/status >/dev/null 2>&1; then
128148 echo "hulykvs started successfully with CockroachDB."
149+ ok=1
129150 break
130151 fi
131152 sleep 2
132153 done
154+ if [ "$ok" -ne 1 ]; then
155+ echo "hulykvs did not start successfully with CockroachDB (no /status response)."
156+ exit 1
157+ fi
133158
134159 kill "$SERVER_PID" || true
135160 wait "$SERVER_PID" || true
0 commit comments