Files
TSYSDevStack/artifacts/SupportStack/tests/test_wakaapi.sh
ReachableCEO 1944b494ee feat: complete MVP implementation of SupportStack with docker-socket-proxy, homepage, and wakaapi
- Implemented docker-socket-proxy, homepage, and wakaapi components using TDD approach
- Created environment settings, control script, and Docker Compose files
- Added comprehensive test suite for all components
- Configured shared Docker network and proper resource limits
- Enabled homepage integration with proper labels
- Fixed homepage host validation issues for VSCode remote access
- Updated status documentation with progress tracking

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-10-28 18:16:49 -05:00

53 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Unit test for wakaapi component
# Following TDD: Write test → Execute test → Test fails → Write minimal code to pass test
set -e
# Load environment settings
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ENV_FILE="${SCRIPT_DIR}/TSYSDevStack-SupportStack-Demo-Settings"
if [ ! -f "$ENV_FILE" ]; then
echo "Error: Environment settings file not found at $ENV_FILE"
exit 1
fi
source "$ENV_FILE"
# Test function to validate wakaapi
test_wakaapi() {
echo "Testing wakaapi availability and functionality..."
# Check if the container exists and is running
if docker ps | grep -q "$WAKAAPI_NAME"; then
echo "✓ wakaapi container is running"
else
echo "✗ wakaapi container is NOT running"
return 1
fi
# Test if wakaapi is accessible on the expected port (after allowing some startup time)
sleep 15 # Allow time for wakaapi to fully start
# Try the main endpoint (health check might not be at /api in Wakapi)
if curl -f -s "http://$BIND_ADDRESS:$WAKAAPI_PORT/" > /dev/null || curl -f -s "http://$BIND_ADDRESS:$WAKAAPI_PORT/api/users" > /dev/null; then
echo "✓ wakaapi is accessible via HTTP"
else
echo "✗ wakaapi is NOT accessible via HTTP at http://$BIND_ADDRESS:$WAKAAPI_PORT/"
return 1
fi
echo "✓ Basic wakaapi test passed"
return 0
}
# Execute the test
if test_wakaapi; then
echo "✓ wakaapi test PASSED"
exit 0
else
echo "✗ wakaapi test FAILED"
exit 1
fi