22 lines
455 B
Bash
22 lines
455 B
Bash
![]() |
#!/bin/bash
|
||
|
# Script to start the server in the background and run tests
|
||
|
|
||
|
echo "Starting the server in the background..."
|
||
|
python3 backend.py > server.log 2>&1 &
|
||
|
SERVER_PID=$!
|
||
|
|
||
|
# Give the server a moment to start
|
||
|
sleep 2
|
||
|
|
||
|
echo "Running tests..."
|
||
|
python3 test_api.py
|
||
|
TEST_RESULT=$?
|
||
|
|
||
|
echo "Stopping the server (PID: $SERVER_PID)..."
|
||
|
kill $SERVER_PID
|
||
|
|
||
|
# Wait for the server to stop
|
||
|
sleep 1
|
||
|
|
||
|
echo "Test completed with exit code: $TEST_RESULT"
|
||
|
exit $TEST_RESULT
|