#!/bin/bash # Run all machine setup tests set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" log() { echo "[Validator] $*" } run_validation_suite() { local test_name="$1" local test_script="$2" echo echo "============================================================" log "Running $test_name" echo "============================================================" if [[ -x "$test_script" ]]; then if "$test_script"; then log "✅ $test_name PASSED" return 0 else log "❌ $test_name FAILED" return 1 fi else log "⚠️ $test_name script not found or not executable: $test_script" return 1 fi } main() { local failed_tests=0 local total_tests=0 log "Machine Setup Validation Suite" log "===============================" # Run all validation suites local tests=( "Core Functions:$SCRIPT_DIR/scripts/validate_functions.sh" "Port Edge Cases:$SCRIPT_DIR/scripts/validate_port_edge_cases.sh" "Dry Run:$SCRIPT_DIR/scripts/validate_dry_run.sh" ) for test in "${tests[@]}"; do IFS=':' read -r test_name test_script <<< "$test" ((total_tests++)) if ! run_validation_suite "$test_name" "$test_script"; then ((failed_tests++)) fi done echo echo "============================================================" log "Test Summary" echo "============================================================" log "Total tests: $total_tests" log "Passed: $((total_tests - failed_tests))" log "Failed: $failed_tests" if [[ $failed_tests -eq 0 ]]; then log "🎉 ALL VALIDATIONS PASSED!" echo log "Machine functionality is ready for deployment testing!" log "Next step: Test on Ubuntu VM with:" log " ./setup.sh gazette test DS412plus" return 0 else log "❌ Some validations failed. Fix issues before deployment." return 1 fi } main "$@"