chore(verify.sh): update monitor verification logic to check for manual with description and remove empty steps check

This commit is contained in:
Nawaz Dhandala
2026-01-22 12:39:14 +00:00
parent a96c270a94
commit 0e27802f1a
2 changed files with 82 additions and 25 deletions

View File

@@ -5,14 +5,14 @@ echo "=== Monitor Steps Basic Test Verification ==="
# Get outputs
MANUAL_NO_STEPS_ID=$(terraform output -raw manual_no_steps_id 2>/dev/null || echo "")
MANUAL_EMPTY_STEPS_ID=$(terraform output -raw manual_empty_steps_id 2>/dev/null || echo "")
MANUAL_WITH_DESCRIPTION_ID=$(terraform output -raw manual_with_description_id 2>/dev/null || echo "")
WITH_INTERVAL_ID=$(terraform output -raw with_interval_id 2>/dev/null || echo "")
DISABLED_ID=$(terraform output -raw disabled_id 2>/dev/null || echo "")
MONITOR_STEPS=$(terraform output -raw manual_no_steps_monitor_steps 2>/dev/null || echo "")
MONITORING_INTERVAL=$(terraform output -raw with_interval_monitoring_interval 2>/dev/null || echo "")
echo "Manual No Steps ID: $MANUAL_NO_STEPS_ID"
echo "Manual Empty Steps ID: $MANUAL_EMPTY_STEPS_ID"
echo "Manual With Description ID: $MANUAL_WITH_DESCRIPTION_ID"
echo "With Interval ID: $WITH_INTERVAL_ID"
echo "Disabled ID: $DISABLED_ID"
echo "Monitor Steps (first 100 chars): ${MONITOR_STEPS:0:100}..."
@@ -24,8 +24,8 @@ if [ -z "$MANUAL_NO_STEPS_ID" ]; then
exit 1
fi
if [ -z "$MANUAL_EMPTY_STEPS_ID" ]; then
echo "ERROR: Manual empty steps monitor was not created"
if [ -z "$MANUAL_WITH_DESCRIPTION_ID" ]; then
echo "ERROR: Manual with description monitor was not created"
exit 1
fi

View File

@@ -35,30 +35,87 @@ echo " Server: ID=$SERVER_ID, Type=$SERVER_TYPE"
# Verify all monitors created
ERRORS=0
declare -A MONITORS=(
["Website"]="$WEBSITE_ID:$WEBSITE_TYPE:Website"
["API"]="$API_ID:$API_TYPE:API"
["Ping"]="$PING_ID:$PING_TYPE:Ping"
["Port"]="$PORT_ID:$PORT_TYPE:Port"
["SSL Certificate"]="$SSL_ID:$SSL_TYPE:SSL Certificate"
["IP"]="$IP_ID:$IP_TYPE:IP"
["Incoming Request"]="$INCOMING_REQUEST_ID:$INCOMING_REQUEST_TYPE:Incoming Request"
["Server"]="$SERVER_ID:$SERVER_TYPE:Server"
)
# Verify each monitor individually to avoid associative array issues with spaces in keys
for NAME in "${!MONITORS[@]}"; do
IFS=':' read -r ID TYPE EXPECTED <<< "${MONITORS[$NAME]}"
# Website
if [ -z "$WEBSITE_ID" ]; then
echo "ERROR: Website monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$WEBSITE_TYPE" != "Website" ]; then
echo "ERROR: Website monitor type mismatch. Expected 'Website', got '$WEBSITE_TYPE'"
ERRORS=$((ERRORS + 1))
fi
if [ -z "$ID" ]; then
echo "ERROR: $NAME monitor not created"
ERRORS=$((ERRORS + 1))
fi
# API
if [ -z "$API_ID" ]; then
echo "ERROR: API monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$API_TYPE" != "API" ]; then
echo "ERROR: API monitor type mismatch. Expected 'API', got '$API_TYPE'"
ERRORS=$((ERRORS + 1))
fi
if [ "$TYPE" != "$EXPECTED" ]; then
echo "ERROR: $NAME monitor type mismatch. Expected '$EXPECTED', got '$TYPE'"
ERRORS=$((ERRORS + 1))
fi
done
# Ping
if [ -z "$PING_ID" ]; then
echo "ERROR: Ping monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$PING_TYPE" != "Ping" ]; then
echo "ERROR: Ping monitor type mismatch. Expected 'Ping', got '$PING_TYPE'"
ERRORS=$((ERRORS + 1))
fi
# Port
if [ -z "$PORT_ID" ]; then
echo "ERROR: Port monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$PORT_TYPE" != "Port" ]; then
echo "ERROR: Port monitor type mismatch. Expected 'Port', got '$PORT_TYPE'"
ERRORS=$((ERRORS + 1))
fi
# SSL Certificate
if [ -z "$SSL_ID" ]; then
echo "ERROR: SSL Certificate monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$SSL_TYPE" != "SSL Certificate" ]; then
echo "ERROR: SSL Certificate monitor type mismatch. Expected 'SSL Certificate', got '$SSL_TYPE'"
ERRORS=$((ERRORS + 1))
fi
# IP
if [ -z "$IP_ID" ]; then
echo "ERROR: IP monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$IP_TYPE" != "IP" ]; then
echo "ERROR: IP monitor type mismatch. Expected 'IP', got '$IP_TYPE'"
ERRORS=$((ERRORS + 1))
fi
# Incoming Request
if [ -z "$INCOMING_REQUEST_ID" ]; then
echo "ERROR: Incoming Request monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$INCOMING_REQUEST_TYPE" != "Incoming Request" ]; then
echo "ERROR: Incoming Request monitor type mismatch. Expected 'Incoming Request', got '$INCOMING_REQUEST_TYPE'"
ERRORS=$((ERRORS + 1))
fi
# Server
if [ -z "$SERVER_ID" ]; then
echo "ERROR: Server monitor not created"
ERRORS=$((ERRORS + 1))
fi
if [ "$SERVER_TYPE" != "Server" ]; then
echo "ERROR: Server monitor type mismatch. Expected 'Server', got '$SERVER_TYPE'"
ERRORS=$((ERRORS + 1))
fi
if [ $ERRORS -gt 0 ]; then
echo ""