#!/bin/bash # Validation Script for A/B Testing Pipeline TDD Implementation # This script validates the TDD implementation by running tests and checking compilation set -e echo "============================================" echo "A/B Testing Pipeline TDD Validation" echo "============================================" echo "" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo "Step 1: Check Docker services" echo "--------------------------------------------" docker-compose ps postgres redis echo "" echo "Step 2: Run database migrations" echo "--------------------------------------------" cargo sqlx migrate run || { echo -e "${RED}Migration failed. Check migration syntax.${NC}" exit 1 } echo -e "${GREEN}Migrations completed successfully${NC}" echo "" echo "Step 3: Compile trading_service" echo "--------------------------------------------" cargo check -p trading_service --tests 2>&1 | tail -20 echo -e "${GREEN}Compilation check complete${NC}" echo "" echo "Step 4: Run A/B testing pipeline tests" echo "--------------------------------------------" echo -e "${YELLOW}Expected: Tests should FAIL (TDD RED phase)${NC}" echo "" cargo test -p trading_service --test ab_testing_pipeline_tests --no-fail-fast 2>&1 | tee ab_testing_test_results.log echo "" echo "============================================" echo "Validation Complete" echo "============================================" echo "" echo "Test Results Summary:" echo "--------------------------------------------" grep -E "(test result:|running)" ab_testing_test_results.log | tail -5 echo "" echo "Full test output saved to: ab_testing_test_results.log" echo "" echo "Next Steps (TDD Cycle):" echo "1. Review test failures (expected in RED phase)" echo "2. Fix compilation errors if any" echo "3. Fix implementation to make tests pass (GREEN phase)" echo "4. Refactor and optimize (REFACTOR phase)" echo "5. Integrate with ensemble coordinator"