#!/bin/bash # Integration test: Service-to-service communication set -euo pipefail test_grafana_influxdb_integration() { # Test Grafana can reach InfluxDB # This would be executed after stack deployment if docker exec tsysdevstack-supportstack-demo-grafana wget -q --spider http://influxdb:8086/ping; then echo "PASS: Grafana-InfluxDB integration" return 0 else echo "FAIL: Grafana-InfluxDB integration" return 1 fi } test_dockhand_docker_integration() { # Test Dockhand can reach Docker socket if docker exec tsysdevstack-supportstack-demo-dockhand docker version >/dev/null 2>&1; then echo "PASS: Dockhand-Docker integration" return 0 else echo "FAIL: Dockhand-Docker integration" return 1 fi } test_homepage_discovery() { # Test Homepage discovers all services local discovered_services discovered_services=$(curl -s http://localhost:4000 | grep -c "service" || echo "0") if [[ $discovered_services -ge 14 ]]; then echo "PASS: Homepage service discovery" return 0 else echo "FAIL: Homepage service discovery (found $discovered_services, expected >=14)" return 1 fi } # Run integration tests test_grafana_influxdb_integration test_dockhand_docker_integration test_homepage_discovery