From 3834d9cf800a0659433eb640cb3b63a947f0ebda Mon Sep 17 00:00:00 2001
From: Nejc Habjan <hab.nejc@gmail.com>
Date: Thu, 20 Feb 2020 00:40:44 +0100
Subject: [PATCH] perf: prepare environment when gitlab is reconfigured

---
 tools/build_test_env.sh | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/tools/build_test_env.sh b/tools/build_test_env.sh
index f5feebf1c..7a3fc2390 100755
--- a/tools/build_test_env.sh
+++ b/tools/build_test_env.sh
@@ -141,20 +141,13 @@ while :; do
     sleep 1
     docker top gitlab-test >/dev/null 2>&1 || fatal "docker failed to start"
     sleep 4
-    # last command started by the container is "gitlab-ctl tail"
-    docker exec gitlab-test pgrep -f 'gitlab-ctl tail' &>/dev/null \
-    && docker exec gitlab-test curl http://localhost/-/health 2>/dev/null \
-        | grep -q 'GitLab OK' \
-    && curl -s http://localhost:8080/users/sign_in 2>/dev/null \
-        | grep -q "GitLab Community Edition" \
+    docker logs gitlab-test 2>&1 | grep "gitlab Reconfigured!" \
     && break
     I=$((I+5))
+    log "Waiting for GitLab to reconfigure.. (${I}s)"
     [ "$I" -lt 180 ] || fatal "timed out"
 done
 
-log "Pausing to give GitLab some time to finish starting up..."
-sleep 200
-
 # Get the token
 TOKEN=$($(dirname $0)/generate_token.py)