From ef82bca68eed6c87cf8815a23f98dfecfe27c503 Mon Sep 17 00:00:00 2001 From: BeauTroll <-> Date: Thu, 18 Dec 2025 17:37:40 +0100 Subject: [PATCH] Add Uptime Kuma testing to test-notifications script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend notification testing script to include Uptime Kuma push monitor tests alongside existing ntfy tests. Changes: - Add 3 Uptime Kuma test scenarios (up, down, up) - Gracefully skip Uptime Kuma tests if not configured - Update script description to include Uptime Kuma - Improve output formatting with separate sections 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- scripts/test-notifications.sh | 66 +++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/scripts/test-notifications.sh b/scripts/test-notifications.sh index db12607..3530ba2 100755 --- a/scripts/test-notifications.sh +++ b/scripts/test-notifications.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Script de test des notifications ntfy +# Script de test des notifications (ntfy et Uptime Kuma) # Usage: ./test-notifications.sh # @@ -98,13 +98,75 @@ else exit 1 fi +echo "" +echo -e "${BLUE}==================================================${NC}" +echo -e "${BLUE}Test des notifications Uptime Kuma${NC}" +echo -e "${BLUE}==================================================${NC}" +echo "" + +# Vérifier si Uptime Kuma est configuré +if [ -z "$UPTIME_KUMA_PUSH_URL" ]; then + echo -e "${YELLOW}⚠️ UPTIME_KUMA_PUSH_URL non configuré${NC}" + echo "Ignoré - configurez UPTIME_KUMA_PUSH_URL dans .env pour tester Uptime Kuma" +else + echo -e "${YELLOW}Configuration:${NC}" + echo " URL: ${UPTIME_KUMA_PUSH_URL}" + echo "" + + # Test 4: Ping Uptime Kuma (succès) + echo -e "${YELLOW}📤 Test 4: Ping Uptime Kuma (status=up)...${NC}" + RESPONSE=$(curl -s -w "\n%{http_code}" "${UPTIME_KUMA_PUSH_URL}?status=up&msg=Test%20success&ping=") + + HTTP_CODE=$(echo "$RESPONSE" | tail -1) + if [ "$HTTP_CODE" -eq 200 ]; then + echo -e "${GREEN}✅ Ping Uptime Kuma (success) envoyé avec succès${NC}" + else + echo -e "${RED}❌ Échec (HTTP $HTTP_CODE)${NC}" + echo "$RESPONSE" + fi + + sleep 2 + + # Test 5: Ping Uptime Kuma (erreur) + echo -e "${YELLOW}📤 Test 5: Ping Uptime Kuma (status=down)...${NC}" + RESPONSE=$(curl -s -w "\n%{http_code}" "${UPTIME_KUMA_PUSH_URL}?status=down&msg=Test%20error&ping=") + + HTTP_CODE=$(echo "$RESPONSE" | tail -1) + if [ "$HTTP_CODE" -eq 200 ]; then + echo -e "${GREEN}✅ Ping Uptime Kuma (error) envoyé avec succès${NC}" + else + echo -e "${RED}❌ Échec (HTTP $HTTP_CODE)${NC}" + fi + + sleep 2 + + # Test 6: Remettre le statut à "up" + echo -e "${YELLOW}📤 Test 6: Remettre Uptime Kuma à up...${NC}" + RESPONSE=$(curl -s -w "\n%{http_code}" "${UPTIME_KUMA_PUSH_URL}?status=up&msg=Test%20complete&ping=") + + HTTP_CODE=$(echo "$RESPONSE" | tail -1) + if [ "$HTTP_CODE" -eq 200 ]; then + echo -e "${GREEN}✅ Statut remis à up${NC}" + else + echo -e "${RED}❌ Échec (HTTP $HTTP_CODE)${NC}" + fi +fi + echo "" echo -e "${GREEN}==================================================${NC}" echo -e "${GREEN}✅ Tous les tests de notification ont réussi !${NC}" echo -e "${GREEN}==================================================${NC}" echo "" -echo "Vérifiez que vous avez reçu 3 notifications sur votre appareil:" +echo -e "${YELLOW}Vérifications:${NC}" +echo "" +echo -e "${BLUE}Ntfy:${NC}" echo " 1. Notification de test simple" echo " 2. Notification de succès de backup" echo " 3. Notification d'erreur de backup" echo "" +if [ -n "$UPTIME_KUMA_PUSH_URL" ]; then + echo -e "${BLUE}Uptime Kuma:${NC}" + echo " 4. Monitor devrait montrer un changement up → down → up" + echo " 5. Vérifiez l'historique dans le dashboard Uptime Kuma" + echo "" +fi