- Move settings file to config/ directory - Move control script to code/ directory - Remove create-network.sh script as requested - Create comprehensive .gitignore file to handle test logs and artifacts - Update all scripts to reference new file locations - Update STATUS.md to reflect new file structure Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
54 lines
1.5 KiB
Bash
Executable File
54 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)"
|
|
CONFIG_DIR="${SCRIPT_DIR}/config"
|
|
ENV_FILE="${CONFIG_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 |