Skip to content

Commit adcd1d4

Browse files
committed
Add startup test&wait loop in distributables tests
Without this we seem to hit issues in Mac 14 M1 usage in GHA sometimes - maybe during GHA high usage periods? This should resolve that more cleanly.
1 parent 9cde47a commit adcd1d4

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

test/distributables-test/unix.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ echo "\nStarting server..."
1111
./httptoolkit-server/bin/httptoolkit-server start &
1212
SERVER_PID=$!
1313

14-
sleep 10
14+
echo "Waiting for server..."
15+
for i in {1..30}; do
16+
if curl -s http://127.0.0.1:45456/ >/dev/null 2>&1; then
17+
echo "Server is up"
18+
break
19+
fi
20+
sleep 1
21+
done
1522

1623
echo "\nTesting server..."
1724

test/distributables-test/windows.bat

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,19 @@ echo Starting server...
1313

1414
START "server" /b .\httptoolkit-server\bin\httptoolkit-server start
1515

16-
REM The closest we can get to a 10 second delay on Windows in CI, ick:
17-
ping -n 10 127.0.0.1 >NUL
16+
echo Waiting for server...
17+
FOR /L %%i IN (1,1,30) DO (
18+
curl -s http://127.0.0.1:45456/ >NUL 2>&1
19+
IF NOT ERRORLEVEL 1 (
20+
echo Server is up
21+
goto :serverup
22+
)
23+
timeout /t 1 /nobreak >NUL
24+
)
25+
echo Server failed to start
26+
goto :error
27+
28+
:serverup
1829

1930
echo:
2031
echo:

0 commit comments

Comments
 (0)