refactor: move stack assets and wire in mailhog
This commit is contained in:
51
SupportStack/output/tests/test_wakaapi_discovery.sh
Executable file
51
SupportStack/output/tests/test_wakaapi_discovery.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test to verify WakaAPI is discovered and displayed on homepage
|
||||
# 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"
|
||||
|
||||
echo "Testing WakaAPI discovery on homepage..."
|
||||
|
||||
# Check if WakaAPI container is running
|
||||
if ! docker ps | grep -q "$WAKAAPI_NAME"; then
|
||||
echo "❌ WakaAPI container is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if homepage container is running
|
||||
if ! docker ps | grep -q "$HOMEPAGE_NAME"; then
|
||||
echo "❌ Homepage container is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Give services a moment to stabilise
|
||||
sleep 5
|
||||
|
||||
# Test if we can access WakaAPI directly
|
||||
if ! curl -f -s "http://${BIND_ADDRESS}:${WAKAAPI_PORT}/" > /dev/null 2>&1; then
|
||||
echo "❌ WakaAPI is not accessible at http://${BIND_ADDRESS}:${WAKAAPI_PORT}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if WakaAPI appears on the homepage services API
|
||||
services_payload=$(curl -s "http://${BIND_ADDRESS}:${HOMEPAGE_PORT}/api/services")
|
||||
if echo "$services_payload" | grep -q "\"container\":\"$WAKAAPI_NAME\""; then
|
||||
echo "✅ WakaAPI is displayed on homepage"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ WakaAPI is NOT displayed on homepage"
|
||||
echo "Test failed: WakaAPI not discovered by homepage"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user