Skip to content

Commit 22b9083

Browse files
author
Kris Armstrong
committed
fix: resolve concurrent request hang in smoke test
The bare `wait` command was blocking indefinitely because it waited for ALL child processes including the long-running web server. Fixed by collecting curl PIDs and waiting only for those specific processes. Also added -m 5 timeouts to all curl requests in performance tests.
1 parent 25c7b10 commit 22b9083

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/smoke/run_smoke_tests.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ test_performance() {
679679
# Hit API rapidly
680680
local request_ok=true
681681
for i in $(seq 1 50); do
682-
if ! curl -s http://localhost:${WEB_PORT_ALT}/api/v1/health >/dev/null 2>&1; then
682+
if ! curl -s -m 5 http://localhost:${WEB_PORT_ALT}/api/v1/health >/dev/null 2>&1; then
683683
request_ok=false
684684
break
685685
fi
@@ -696,13 +696,17 @@ test_performance() {
696696

697697
# Concurrent requests
698698
local concurrent_ok=true
699+
local curl_pids=""
699700
for i in $(seq 1 10); do
700-
curl -s http://localhost:${WEB_PORT_ALT}/api/v1/health &
701+
curl -s -m 5 http://localhost:${WEB_PORT_ALT}/api/v1/health >/dev/null 2>&1 &
702+
curl_pids="$curl_pids $!"
703+
done
704+
for pid in $curl_pids; do
705+
wait $pid 2>/dev/null || true
701706
done
702-
wait
703707

704708
TESTS_RUN=$((TESTS_RUN + 1))
705-
if curl -s http://localhost:${WEB_PORT_ALT}/api/v1/health | grep -q "healthy"; then
709+
if curl -s -m 5 http://localhost:${WEB_PORT_ALT}/api/v1/health | grep -q "healthy"; then
706710
log_pass "Web server handles concurrent requests"
707711
TESTS_PASSED=$((TESTS_PASSED + 1))
708712
else

0 commit comments

Comments
 (0)