41 lines
		
	
	
		
			1000 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1000 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| # Test to ensure Mailhog appears in Homepage discovery
 | |
| 
 | |
| set -e
 | |
| 
 | |
| 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 Mailhog discovery on homepage..."
 | |
| 
 | |
| # Validate required containers are running
 | |
| if ! docker ps | grep -q "$MAILHOG_NAME"; then
 | |
|     echo "❌ Mailhog container is not running"
 | |
|     exit 1
 | |
| fi
 | |
| 
 | |
| if ! docker ps | grep -q "$HOMEPAGE_NAME"; then
 | |
|     echo "❌ Homepage container is not running"
 | |
|     exit 1
 | |
| fi
 | |
| 
 | |
| # Allow homepage time to refresh discovery
 | |
| sleep 5
 | |
| 
 | |
| services_payload=$(curl -s "http://${BIND_ADDRESS}:${HOMEPAGE_PORT}/api/services")
 | |
| if echo "$services_payload" | grep -q "\"container\":\"$MAILHOG_NAME\""; then
 | |
|     echo "✅ Mailhog is discoverable on homepage"
 | |
|     exit 0
 | |
| else
 | |
|     echo "❌ Mailhog is NOT discoverable on homepage"
 | |
|     exit 1
 | |
| fi
 |