1
0
Fork 1
mirror of https://github.com/thatmattlove/hyperglass.git synced 2026-01-17 08:48:05 +00:00
thatmattlove-hyperglass/.tests/app/setup.sh
2020-02-23 10:09:24 -07:00

40 lines
No EOL
813 B
Bash
Executable file

#!/bin/sh -l
get_status () {
echo $(curl -s -o /dev/null -w "%{http_code}" http://localhost:8001)
}
echo "[INFO] Starting Redis..."
redis-server &
cd /tmp/hyperglass
echo "[INFO] Starting setup..."
poetry run hyperglass setup -d
echo "[SUCCESS] Setup completed."
sleep 2
echo "[INFO] Starting UI build."
poetry run hyperglass build-ui
echo "[SUCCESS] UI build completed."
echo "[INFO] Starting hyperglass..."
poetry run hyperglass start &> /var/log/hyperglassci.log &
sleep 10
if [[ ! $? == 0 ]]; then
echo "[ERROR] Failed to start hyperglass."
exit 1
fi
echo "[SUCCESS] Started hyperglass."
echo "[INFO] Running HTTP test..."
echo "[INFO] Status code: $(get_status)"
if [[ ! $? == 0 ]]; then
echo "[ERROR] HTTP test failed."
exit 1
fi
echo "[SUCCESS] Tests ran successfully."
exit 0