Skip to content

Commit b0345e6

Browse files
committed
Don't wait forever for Galaxy to start
1 parent 363bbf9 commit b0345e6

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

run_bioblend_tests.sh

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ if [ -n "${r_val}" ]; then
7676
git checkout "${r_val}"
7777
if git show-ref -q --verify "refs/heads/${r_val}" 2>/dev/null; then
7878
# ${r_val} is a branch
79-
export GALAXY_VERSION=${r_val}
79+
export GALAXY_VERSION="${r_val}"
8080
git pull --ff-only
8181
fi
8282
else
8383
BRANCH=$(git rev-parse --abbrev-ref HEAD)
8484
case $BRANCH in
8585
dev | release_*)
86-
export GALAXY_VERSION=$BRANCH
86+
export GALAXY_VERSION="$BRANCH"
8787
;;
8888
esac
8989
fi
@@ -138,24 +138,35 @@ else
138138
echo 'galaxyctl status not working'
139139
exit 1
140140
fi
141-
while true; do
142-
sleep 1
141+
MAX_WAIT=120
142+
i=0
143+
while [ $i -lt $MAX_WAIT ]; do
143144
if .venv/bin/galaxyctl status | grep -q 'gunicorn.*RUNNING'; then
144145
break
145-
else
146-
echo 'gunicorn not running yet'
147146
fi
148-
done
149-
while true; do
147+
echo 'gunicorn not running yet'
150148
sleep 1
149+
i=$((i + 1))
150+
done
151+
if [ $i -eq $MAX_WAIT ]; then
152+
echo 'gunicorn failed to start'
153+
exit 1
154+
fi
155+
i=0
156+
while [ $i -lt $MAX_WAIT ]; do
151157
if grep -q "[Ss]erving on http://127.0.0.1:${GALAXY_PORT}" "${GRAVITY_STATE_DIR}/log/gunicorn.log"; then
152158
break
153-
else
154-
echo 'Galaxy not serving yet'
155159
fi
160+
echo 'Galaxy not serving yet'
161+
sleep 1
162+
i=$((i + 1))
156163
done
164+
if [ $i -eq $MAX_WAIT ]; then
165+
echo 'Galaxy failed to start'
166+
exit 1
167+
fi
157168
fi
158-
export BIOBLEND_GALAXY_URL=http://localhost:${GALAXY_PORT}
169+
export BIOBLEND_GALAXY_URL=http://localhost:"${GALAXY_PORT}"
159170

160171
# Run the tests
161172
cd "${BIOBLEND_DIR}"

0 commit comments

Comments
 (0)