added test_static_page.sh script
All checks were successful
Build,test and deploy reaktionsfaehig.net / deploy-prod (push) Successful in 18s
All checks were successful
Build,test and deploy reaktionsfaehig.net / deploy-prod (push) Successful in 18s
This commit is contained in:
parent
b21f636a4b
commit
d9c560e590
1 changed files with 26 additions and 0 deletions
26
bin/test_static_page.sh
Executable file
26
bin/test_static_page.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
PORT=8080
|
||||
python3 -m http.server $PORT --directory public/ &
|
||||
|
||||
SERVER_PID=$!
|
||||
|
||||
# Give it a moment to start
|
||||
sleep 2
|
||||
|
||||
# Check if the server is running
|
||||
if ! ps -p $SERVER_PID > /dev/null; then
|
||||
echo "HTTP server failed to start."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check HTTP status
|
||||
status_code=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:$PORT)
|
||||
|
||||
# Kill the http server
|
||||
kill $SERVER_PID
|
||||
|
||||
# Check if status code is 200
|
||||
if [ "$status_code" -ne 200 ]; then
|
||||
echo "Website returned a non-200 status code: $status_code"
|
||||
exit 1
|
||||
fi
|
Loading…
Add table
Reference in a new issue