run-tests.sh: timeout after a minute

This commit is contained in:
David Robertson 2023-09-20 11:12:23 +01:00
parent 4da081374c
commit afdb0d7b80
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
2 changed files with 9 additions and 0 deletions

View File

@ -92,6 +92,9 @@ jobs:
matrix:
# test with unlimited + 1 + 2 max db conns. If we end up double transacting in the tests anywhere, conn=1 tests will fail.
max_db_conns: [0,1,2]
# If the server fails to start, we'll wait for GHA to cancel the job after 6 hours.
# Ensure we fail sooner than that to avoid clogging up GHA runners.
timeout-minutes: 30
services:
synapse:
# Custom image built from https://github.com/matrix-org/synapse/tree/v1.72.0/docker/complement with a dummy /complement/ca set

View File

@ -10,10 +10,16 @@ SYNCV3_PID=$!
trap "kill $SYNCV3_PID" EXIT
# wait for the server to be listening, we want this endpoint to 404 instead of connrefused
attempts=0
until [ \
"$(curl -s -w '%{http_code}' -o /dev/null "http://localhost:8844/idonotexist")" \
-eq 404 ]
do
((attempts++))
if [ "$attempts" -gt 60 ]; then
echo "Server did not start after $attempts seconds" > /dev/stderr
exit 1
fi
echo 'Waiting for server to start...'
sleep 1
done