fix: Update test script to use root endpoint for health check

Nginx load balancer intercepts /health and returns plain text.
Updated test to use root endpoint (/) which returns JSON and verify
backend is actually running.
This commit is contained in:
Alexis Bruneteau 2025-11-07 03:10:54 +01:00
parent 9f5aee8b93
commit d9b6b66813

View File

@ -183,22 +183,23 @@ def test_backend_health():
print("="*60) print("="*60)
try: try:
response = requests.get(f"{BASE_URL}/health") # Try the root endpoint for health (Nginx intercepts /health with plain text)
response = requests.get(f"{BASE_URL}/")
data = response.json() data = response.json()
if data.get("status") == "ok": if data.get("name"):
print(f"✓ Backend is running") print(f"✓ Backend is running")
print(f" Status: {data['status']}") print(f" Name: {data['name']}")
print(f" Version: {data.get('version', 'unknown')}") print(f" Version: {data.get('version', 'unknown')}")
return True return True
else: else:
print(f"✗ Backend health check failed: {data}") print(f"✗ Backend response unexpected: {data}")
return False return False
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
print("✗ Cannot connect to backend") print("✗ Cannot connect to backend")
print(f" Make sure backend is running on {BASE_URL}") print(f" Make sure backend is running on {BASE_URL}")
print(" Run: docker compose up -d backend") print(" Run: docker compose -f docker-compose.multinode.yml up -d")
return False return False
except Exception as e: except Exception as e:
print(f"✗ Error: {e}") print(f"✗ Error: {e}")