add security test 07

This commit is contained in:
TronoSfera 2026-03-02 17:44:02 +03:00
parent 1e9b326dad
commit d5fa325f58
2 changed files with 7 additions and 4 deletions

View file

@ -5,6 +5,7 @@ BASE_URL="${1:-http://localhost:8081}"
CHAT_HEALTH_URL="${BASE_URL%/}/chat-health" CHAT_HEALTH_URL="${BASE_URL%/}/chat-health"
BACKEND_HEALTH_URL="${BASE_URL%/}/health" BACKEND_HEALTH_URL="${BASE_URL%/}/health"
EMAIL_HEALTH_URL="${BASE_URL%/}/email-health" EMAIL_HEALTH_URL="${BASE_URL%/}/email-health"
CHECK_CHAT_HEALTH_SKIP_DOCKER_CHECKS="${CHECK_CHAT_HEALTH_SKIP_DOCKER_CHECKS:-0}"
check_http_200() { check_http_200() {
url="$1" url="$1"
@ -27,9 +28,11 @@ if ! check_http_200 "$EMAIL_HEALTH_URL"; then
exit 5 exit 5
fi fi
if docker compose ps --format json 2>/dev/null | grep -q '"Health":"unhealthy"'; then if [ "$CHECK_CHAT_HEALTH_SKIP_DOCKER_CHECKS" != "1" ]; then
if docker compose ps --format json 2>/dev/null | grep -q '"Health":"unhealthy"'; then
echo "[ALERT] at least one container has unhealthy state" >&2 echo "[ALERT] at least one container has unhealthy state" >&2
exit 4 exit 4
fi
fi fi
echo "[OK] chat-service, backend and email-service are healthy" echo "[OK] chat-service, backend and email-service are healthy"

View file

@ -164,7 +164,7 @@ run_local_smoke() {
candidate="$(echo "$candidate" | xargs)" candidate="$(echo "$candidate" | xargs)"
[[ -z "$candidate" ]] && continue [[ -z "$candidate" ]] && continue
if ./scripts/ops/check_chat_health.sh "$candidate" >/dev/null 2>&1 && \ if CHECK_CHAT_HEALTH_SKIP_DOCKER_CHECKS="$LOCAL_SMOKE_SKIP_DOCKER_CHECKS" ./scripts/ops/check_chat_health.sh "$candidate" >/dev/null 2>&1 && \
SECURITY_SMOKE_SKIP_DOCKER_CHECKS="$LOCAL_SMOKE_SKIP_DOCKER_CHECKS" ./scripts/ops/security_smoke.sh "$candidate" >/dev/null 2>&1; then SECURITY_SMOKE_SKIP_DOCKER_CHECKS="$LOCAL_SMOKE_SKIP_DOCKER_CHECKS" ./scripts/ops/security_smoke.sh "$candidate" >/dev/null 2>&1; then
log "Local smoke checks passed via ${candidate} (attempt ${attempt}/${max_attempts})" log "Local smoke checks passed via ${candidate} (attempt ${attempt}/${max_attempts})"
ok=1 ok=1