diff --git a/scripts/functions.bash b/scripts/functions.bash index d1c5d36..cca7b35 100755 --- a/scripts/functions.bash +++ b/scripts/functions.bash @@ -58,11 +58,21 @@ log() wait_sonarqube_up() { sonar_status="DOWN" + http_code=0 log $INFO "initiating connection with SonarQube." sleep 15 + while [ "$http_code" -ne 200 ] + do + sleep 5 + http_code=$(curl -i -su "admin:$SONARQUBE_ADMIN_PASSWORD" "${SONARQUBE_URL}" \ + | sed -n -r -e 's/^HTTP\/.+ ([0-9]+)/\1/p') + http_code=${http_code:0:3} # remove \n + log $INFO "SonarQube HTTP code is ${http_code}, expecting it to be 200." + done + log $INFO "SonarQube HTTP code is ${http_code}" while [ "${sonar_status}" != "UP" ] do - sleep 20 + sleep 5 sonar_status=$(curl -s -X GET "${SONARQUBE_URL}/api/system/status" | jq -r '.status') log $INFO "SonarQube is ${sonar_status}, expecting it to be UP." done diff --git a/tests/test_cnes_sonarqube.py b/tests/test_cnes_sonarqube.py index ddde9e5..3517d96 100644 --- a/tests/test_cnes_sonarqube.py +++ b/tests/test_cnes_sonarqube.py @@ -121,7 +121,7 @@ def test_check_plugins(self): ("Kotlin Code Quality and Security","2.12.0 (build 1956)"), ("PHP Code Quality and Security","3.27.1 (build 9352)"), ("PMD", "3.4.0"), - ("Python Code Quality and Security","3.24 (build 10784)"), + ("Python Code Quality and Security", "3.24.1 (build 11916)"), ("Ruby Code Quality and Security","1.11.0 (build 3905)"), ("Scala Code Quality and Security","1.11.0 (build 3905)"), ("ShellCheck Analyzer","2.5.0"),