24 lines
497 B
Bash
Executable File
24 lines
497 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
URL="http://localhost:8091/health"
|
|
echo "[tests] Vérification /health: $URL"
|
|
|
|
http_code=$(curl -s -o /tmp/health_body.txt -w "%{http_code}" "$URL")
|
|
body=$(cat /tmp/health_body.txt)
|
|
|
|
echo "HTTP $http_code"
|
|
echo "Body: $body"
|
|
|
|
if [[ "$http_code" != "200" ]]; then
|
|
echo "Échec: code HTTP inattendu" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$body" != '{"status":"ok"}' ]]; then
|
|
echo "Échec: corps inattendu" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Succès: endpoint /health opérationnel"
|