Files
foxhunt/tests/e2e_helpers/QUICK_START_INFRASTRUCTURE.md
jgrusewski 1b0a122174 Wave 144-145: Test enablement and JWT authentication fix
Wave 144: Enable 112 infrastructure and E2E tests
- Remove #[ignore] from PostgreSQL tests (41 tests)
- Remove #[ignore] from Redis tests (18 tests)
- Remove #[ignore] from Vault tests (11 tests)
- Remove #[ignore] from E2E tests (42 tests: service health, backtesting, trading)
- Fix test_metrics_output (add metrics initialization)
- Create infrastructure health check script

Wave 145: Fix JWT authentication for E2E tests
- Add JWT_SECRET, JWT_ISSUER, JWT_AUDIENCE to Trading Service
- Add JWT_SECRET, JWT_ISSUER, JWT_AUDIENCE to Backtesting Service
- Add JWT_SECRET, JWT_ISSUER, JWT_AUDIENCE to ML Training Service
- Fix auth_helpers.rs hardcoded issuer/audience values
- Migrate E2E tests to TestAuthConfig pattern

Root Cause (Wave 145): Backend services missing JWT environment variables
Solution: Unified JWT configuration across all services
Result: Services healthy, E2E tests need .env sourced for validation

Agents: 311-320 (Wave 144), 331-342 (Wave 145)
Files Modified: 35 (14 modified, 21 created)
Documentation: 21 reports created (1,455+ lines)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 15:37:38 +02:00

3.2 KiB

Quick Start: Infrastructure Validation

For Agents and Developers: Fast reference guide for infrastructure validation


TL;DR - One Command

# Validate all infrastructure (from project root)
./tests/e2e_helpers/infrastructure_health_check.sh

# Check exit code
echo $?
# 0 = All healthy, proceed
# 1 = Critical failure, DO NOT PROCEED
# 2 = Optional failure, can proceed with warnings

Service Status Quick Check

# All services at a glance
docker-compose ps

# Expected output: All services "Up (healthy)"

Critical Services (MUST BE HEALTHY)

PostgreSQL - Port 5432

# Quick test
psql postgresql://foxhunt:foxhunt_dev_password@localhost:5432/foxhunt -c 'SELECT 1'

# Should return: (1 row)

Redis - Port 6379

# Quick test
docker exec foxhunt-redis redis-cli ping

# Should return: PONG

Vault - Port 8200

# Quick test
curl -s http://localhost:8200/v1/sys/health | jq '.sealed'

# Should return: false

Application Services

All should be "Up (healthy)" in docker-compose ps:

  • API Gateway: Port 50051
  • Trading Service: Port 50052
  • Backtesting Service: Port 50053
  • ML Training Service: Port 50054

Common Issues

Service Not Healthy

# Restart single service
docker-compose restart <service_name>

# View logs
docker-compose logs -f <service_name>

All Services Down

# Restart all services
docker-compose down
docker-compose up -d

# Wait 30-60 seconds for health checks
docker-compose ps

PostgreSQL Connection Failed

# Check if running
docker-compose ps postgres

# Restart
docker-compose restart postgres

# Verify migrations
cd /home/jgrusewski/Work/foxhunt
cargo sqlx migrate run

Pre-Test Checklist

Before running any E2E tests:

  • Run ./tests/e2e_helpers/infrastructure_health_check.sh
  • Exit code = 0 (all healthy)
  • PostgreSQL responding to queries
  • Redis responding to PING
  • Vault unsealed

URLs Quick Reference

Service URL Credentials
PostgreSQL postgresql://localhost:5432/foxhunt foxhunt / foxhunt_dev_password
Redis redis://localhost:6379 (no auth)
Vault http://localhost:8200 Token: foxhunt-dev-root
Prometheus http://localhost:9090 (no auth)
Grafana http://localhost:3000 admin / foxhunt123
MinIO Console http://localhost:9001 foxhunt_test / foxhunt_test_password

Integration Example

#!/bin/bash
# Example E2E test runner

echo "Validating infrastructure..."
./tests/e2e_helpers/infrastructure_health_check.sh
EXIT_CODE=$?

if [ $EXIT_CODE -eq 1 ]; then
    echo "ERROR: Critical services down, cannot proceed"
    exit 1
elif [ $EXIT_CODE -eq 2 ]; then
    echo "WARNING: Optional services down, continuing..."
fi

echo "Running E2E tests..."
cargo test --test e2e_trading_integration

Full Documentation

For comprehensive details, see:

  • INFRASTRUCTURE_VALIDATION.md - Complete validation guide
  • AGENT_314_INFRASTRUCTURE_VALIDATION_REPORT.md - Validation results

Last Validated: 2025-10-12 (Agent 314, Wave 137) Status: 100% HEALTHY (17/17 checks passed)