Skip to content

Commit 7d424ae

Browse files
author
Gauvain Pocentek
committed
Workaround gitlab setup failure in tests
While running the functional tests in a venv, the token download somtimes fail. Try to get it multiple times before failing.
1 parent 3371e0e commit 7d424ae

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

tools/build_test_env.sh

+16-11
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,25 @@ while :; do
102102
I=$((I+5))
103103
[ "$I" -lt 120 ] || fatal "timed out"
104104
done
105-
sleep 5
106105

107106
# Get the token
108107
log "Getting GitLab token..."
109-
TOKEN_JSON=$(
110-
try curl -s http://localhost:8080/api/v3/session \
111-
-X POST \
112-
--data "login=$LOGIN&password=$PASSWORD"
113-
) || exit 1
114-
TOKEN=$(
115-
pecho "${TOKEN_JSON}" |
116-
try python -c \
117-
'import sys, json; print(json.load(sys.stdin)["private_token"])'
118-
) || exit 1
108+
I=0
109+
while :; do
110+
sleep 1
111+
TOKEN_JSON=$(
112+
try curl -s http://localhost:8080/api/v3/session \
113+
-X POST \
114+
--data "login=$LOGIN&password=$PASSWORD"
115+
) >/dev/null 2>&1 || true
116+
TOKEN=$(
117+
pecho "${TOKEN_JSON}" |
118+
try python -c \
119+
'import sys, json; print(json.load(sys.stdin)["private_token"])'
120+
) >/dev/null 2>&1 && break
121+
I=$((I+1))
122+
[ "$I" -lt 20 ] || fatal "timed out"
123+
done
119124

120125
cat > $CONFIG << EOF
121126
[global]

0 commit comments

Comments
 (0)