Files
attack-defense-platform/panel/verify_topo_full.sh
T

38 lines
1.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Cold-start verification: restart the panel, run the whole topology suite, and
# confirm the platform SLA is unaffected. This is the check to run after any
# change to the topology renderer.
set -u
export PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
echo "=== restart panel ==="
systemctl restart gemastik-panel
sleep 7
echo "gemastik-panel: $(systemctl is-active gemastik-panel)"
echo
echo "=== topology test suite ==="
bash /opt/gemastik18-final/panel/run_topo_tests.sh
suite=$?
echo
echo "=== platform SLA ==="
curl -sS "http://127.0.0.1:18081/api/public/scoreboard" | python3 -c "
import json, sys
d = json.load(sys.stdin)
ta = tt = 0
for t in d.get('teams', []):
a, n = t.get('alive', 0), t.get('total', 0)
ta += a; tt += n
print(f\" team {t.get('label')}: SLA {a}/{n}\")
print(f' TOTAL: {ta}/{tt}' + (f' ({100*ta/tt:.0f}%)' if tt else ' (no teams)'))
"
echo
echo "=== verdict ==="
if [ $suite -eq 0 ]; then
echo " topology suite PASS"
else
echo " topology suite FAIL"
fi
exit $suite