homelab infrastructure services
1#!/bin/bash
2
3# Run all machine setup tests
4
5set -euo pipefail
6
7SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
9log() {
10 echo "[Validator] $*"
11}
12
13run_validation_suite() {
14 local test_name="$1"
15 local test_script="$2"
16
17 echo
18 echo "============================================================"
19 log "Running $test_name"
20 echo "============================================================"
21
22 if [[ -x "$test_script" ]]; then
23 if "$test_script"; then
24 log "✅ $test_name PASSED"
25 return 0
26 else
27 log "❌ $test_name FAILED"
28 return 1
29 fi
30 else
31 log "⚠️ $test_name script not found or not executable: $test_script"
32 return 1
33 fi
34}
35
36main() {
37 local failed_tests=0
38 local total_tests=0
39
40 log "Machine Setup Validation Suite"
41 log "==============================="
42
43 # Run all validation suites
44 local tests=(
45 "Core Functions:$SCRIPT_DIR/scripts/validate_functions.sh"
46 "Port Edge Cases:$SCRIPT_DIR/scripts/validate_port_edge_cases.sh"
47 "Dry Run:$SCRIPT_DIR/scripts/validate_dry_run.sh"
48 )
49
50 for test in "${tests[@]}"; do
51 IFS=':' read -r test_name test_script <<< "$test"
52 ((total_tests++))
53
54 if ! run_validation_suite "$test_name" "$test_script"; then
55 ((failed_tests++))
56 fi
57 done
58
59 echo
60 echo "============================================================"
61 log "Test Summary"
62 echo "============================================================"
63 log "Total tests: $total_tests"
64 log "Passed: $((total_tests - failed_tests))"
65 log "Failed: $failed_tests"
66
67 if [[ $failed_tests -eq 0 ]]; then
68 log "🎉 ALL VALIDATIONS PASSED!"
69 echo
70 log "Machine functionality is ready for deployment testing!"
71 log "Next step: Test on Ubuntu VM with:"
72 log " ./setup.sh gazette test DS412plus"
73 return 0
74 else
75 log "❌ Some validations failed. Fix issues before deployment."
76 return 1
77 fi
78}
79
80main "$@"