Spaces:
Runtime error
Runtime error
File size: 530 Bytes
152120d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/bin/bash
CONTAINER_ID=$1
SCORE=0
# Example Test 1: Endpoint check
RESPONSE=$(docker exec "$CONTAINER_ID" curl -s http://localhost:5000/hello)
EXPECTED="Hello, World!"
if [ "$RESPONSE" == "$EXPECTED" ]; then
SCORE=$((SCORE + 10))
else
echo "Test 1 failed: Expected '$EXPECTED', got '$RESPONSE'"
fi
# Example Test 2: Check for file existence
docker exec "$CONTAINER_ID" test -f /app/main.py
if [ $? -eq 0 ]; then
SCORE=$((SCORE + 5))
else
echo "Test 2 failed: main.py not found"
fi
echo $SCORE
|