ci / lint (push) Successful in 46s
Watchdog notify crash root-caused: iOS companion schema rejects data.clickAction; url is the iOS deep-link key. Suite updated to assert url presence per alert. https://projects.knownelement.com/issues/778
52 lines
1.7 KiB
Bash
52 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# SDLC regression tests (#778) — run in CI (see .gitea/workflows/ci.yml).
|
|
# Each test guards a rule that exists because of a real incident or ruling.
|
|
set -uo pipefail
|
|
cd "$(dirname "$0")/.." || exit 1
|
|
|
|
FAIL=0
|
|
t() {
|
|
# $1 = label, $2 = shell command string
|
|
if eval "$2"; then
|
|
echo " OK $1"
|
|
else
|
|
echo " FAIL $1"
|
|
FAIL=$((FAIL + 1))
|
|
fi
|
|
}
|
|
|
|
echo "=== alert twins (every alert ships a recovery twin) ==="
|
|
t "utility power restored twin" \
|
|
"grep -q 'id: pfv_plant_ups_power_restored' automations.yaml"
|
|
t "temperature recovered twin" \
|
|
"grep -q 'id: pfv_plant_temperature_recovered' automations.yaml"
|
|
|
|
echo "=== alert deep links (taps land on dashboards, #344) ==="
|
|
ALERTS="POWER OUTAGE|UPS BATTERY LOW|UPS COMMS LOST|UPS RUNTIME LOW|Power restored|HIGH TEMPERATURE|SENSOR WATCHDOG|TEMP RISING FAST|TEMPERATURE RECOVERED"
|
|
DL_OK=1
|
|
IFS='|' read -ra ALERT_ARR <<< "$ALERTS"
|
|
for a in "${ALERT_ARR[@]}"; do
|
|
if ! grep -A2 "title: $a$" automations.yaml | grep -q " url: "; then
|
|
echo " (missing deep link: $a)"
|
|
DL_OK=0
|
|
fi
|
|
done
|
|
t "all alerts deep-linked" "[ \"$DL_OK\" -eq 1 ]"
|
|
|
|
echo "=== watchdog coverage (#789) ==="
|
|
t "watchdog watches the deploy sensor" \
|
|
"grep -q 'sensor.pfv_deploy_gitea_release_head, 30' automations.yaml"
|
|
t "watchdog automation exists" \
|
|
"grep -q 'id: pfv_watchdog_stale_entities' automations.yaml"
|
|
|
|
echo "=== ghost entities (dead references never return) ==="
|
|
t "no tsys9_ups ghost refs" \
|
|
"! grep -rq 'tsys9_ups' automations.yaml packages/ dashboards/"
|
|
|
|
echo "=== secrets ==="
|
|
t "no private keys in tree" \
|
|
"! grep -rInE 'BEGIN (RSA |OPENSSH |EC |DSA )?PRIVATE KEY' --exclude-dir=.git --exclude-dir=docs ."
|
|
|
|
echo "=== SDLC SUITE: $FAIL failures ==="
|
|
exit "$FAIL"
|