Skip to content

Commit 1af481c

Browse files
Improve Rails server startup wait logic with timeout and elapsed time reporting
1 parent bbe3be3 commit 1af481c

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/pro-integration-tests.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,18 @@ jobs:
210210
RAILS_ENV=test rails server &
211211
212212
- name: Wait for Rails server to start
213-
run: while ! curl -s http://localhost:3000 > /dev/null; do sleep 1; done
213+
run: |
214+
timeout=60
215+
elapsed=0
216+
while ! curl -s http://localhost:3000 > /dev/null; do
217+
sleep 1
218+
elapsed=$((elapsed + 1))
219+
if [ $elapsed -ge $timeout ]; then
220+
echo "Timeout waiting for Rails server to start after ${timeout}s"
221+
exit 1
222+
fi
223+
done
224+
echo "Rails server started after ${elapsed}s"
214225
215226
- name: Run RSpec tests for Pro dummy app
216227
run: |
@@ -384,7 +395,18 @@ jobs:
384395
RAILS_ENV=test rails server &
385396
386397
- name: Wait for Rails server to start
387-
run: while ! curl -s http://localhost:3000 > /dev/null; do sleep 1; done
398+
run: |
399+
timeout=300
400+
elapsed=0
401+
while ! curl -s http://localhost:3000 > /dev/null; do
402+
sleep 1
403+
elapsed=$((elapsed + 1))
404+
if [ $elapsed -ge $timeout ]; then
405+
echo "Timeout waiting for Rails server to start after ${timeout}s"
406+
exit 1
407+
fi
408+
done
409+
echo "Rails server started after ${elapsed}s"
388410
389411
- name: Install Playwright dependencies
390412
run: cd spec/dummy && yarn playwright install --with-deps

0 commit comments

Comments
 (0)