1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
checktheroads-hyperglass/.tests/ga-backend-app.sh

63 lines
1.5 KiB
Bash
Raw Normal View History

2021-01-01 14:23:15 -07:00
#!/usr/bin/env bash
2021-01-01 14:53:37 -07:00
LOG_FILE="$HOME/hyperglass-ci.log"
2021-12-06 16:52:11 -07:00
touch /tmp/hyperglass.log
2021-01-01 14:53:37 -07:00
2021-01-04 00:46:30 -07:00
export POETRY_HYPERGLASS_UI_BUILD_TIMEOUT="600"
echo "[INFO] Set build timeout to $POETRY_HYPERGLASS_UI_BUILD_TIMEOUT seconds"
2021-01-01 14:23:15 -07:00
echo "[INFO] Starting setup..."
2021-12-06 16:44:46 -07:00
poetry run hyperglass setup -d &>$LOG_FILE
2021-01-01 14:23:15 -07:00
echo "[SUCCESS] Setup completed."
sleep 2
2021-12-06 16:44:46 -07:00
echo "[INFO] Copying directives.yaml file..."
cp ./hyperglass/examples/directives.yaml $HOME/hyperglass/directives.yaml
2021-01-03 10:41:13 -07:00
echo "[INFO] Copying devices.yaml file..."
cp ./hyperglass/examples/devices.yaml $HOME/hyperglass/devices.yaml
2021-01-01 14:23:15 -07:00
echo "[INFO] Starting UI build."
2021-12-06 16:44:46 -07:00
poetry run hyperglass build-ui &>$LOG_FILE
2021-01-01 14:23:15 -07:00
if [[ ! $? == 0 ]]; then
2021-01-04 00:46:30 -07:00
echo "[ERROR] Failed to build hyperglass ui."
cat /tmp/hyperglass.log
2021-01-04 00:58:40 -07:00
cat $LOG_FILE
2021-01-01 14:23:15 -07:00
exit 1
else
echo "[SUCCESS] UI build completed."
fi
echo "[INFO] Starting hyperglass..."
2021-12-06 16:44:46 -07:00
poetry run hyperglass start &>$LOG_FILE &
sleep 120
2021-01-01 14:23:15 -07:00
if [[ ! $? == 0 ]]; then
echo "[ERROR] Failed to start hyperglass."
2021-01-04 00:46:30 -07:00
cat /tmp/hyperglass.log
2021-01-04 00:58:40 -07:00
cat $LOG_FILE
2021-01-01 14:23:15 -07:00
exit 1
else
echo "[SUCCESS] Started hyperglass."
fi
echo "[INFO] Running HTTP test..."
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8001)
echo "[INFO] Status code: $STATUS"
if [[ ! $? == 0 ]]; then
echo "[ERROR] HTTP test failed."
exit 1
elif [[ ! "$STATUS" == "200" ]]; then
2021-01-04 00:46:30 -07:00
echo "[ERROR] HTTP test failed."
2021-01-04 00:58:40 -07:00
cat /tmp/hyperglass.log
2021-01-01 14:53:37 -07:00
cat $LOG_FILE
2021-01-01 14:23:15 -07:00
exit 1
fi
echo "[SUCCESS] Tests ran successfully."
2021-01-01 14:53:37 -07:00
exit 0