diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-09-30 07:00:07 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-09-30 07:05:44 +0200 |
commit | 7d424ae5a4dad41533af7add24d728c315563022 (patch) | |
tree | b9c0554b7dd220eaba6816a5c24a98e1a46c0f36 | |
parent | 3371e0e1281a8d6dfa22e921bee98214b60c1ff1 (diff) | |
download | gitlab-7d424ae5a4dad41533af7add24d728c315563022.tar.gz |
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.
-rwxr-xr-x | tools/build_test_env.sh | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tools/build_test_env.sh b/tools/build_test_env.sh index 7881c18..3f6191a 100755 --- a/tools/build_test_env.sh +++ b/tools/build_test_env.sh @@ -102,20 +102,25 @@ while :; do I=$((I+5)) [ "$I" -lt 120 ] || fatal "timed out" done -sleep 5 # Get the token log "Getting GitLab token..." -TOKEN_JSON=$( - try curl -s http://localhost:8080/api/v3/session \ - -X POST \ - --data "login=$LOGIN&password=$PASSWORD" -) || exit 1 -TOKEN=$( - pecho "${TOKEN_JSON}" | - try python -c \ - 'import sys, json; print(json.load(sys.stdin)["private_token"])' -) || exit 1 +I=0 +while :; do + sleep 1 + TOKEN_JSON=$( + try curl -s http://localhost:8080/api/v3/session \ + -X POST \ + --data "login=$LOGIN&password=$PASSWORD" + ) >/dev/null 2>&1 || true + TOKEN=$( + pecho "${TOKEN_JSON}" | + try python -c \ + 'import sys, json; print(json.load(sys.stdin)["private_token"])' + ) >/dev/null 2>&1 && break + I=$((I+1)) + [ "$I" -lt 20 ] || fatal "timed out" +done cat > $CONFIG << EOF [global] |