#!/usr/bin/env bash # Created by John A. Hoeven with the ethical assistance of Claude AI # --------------------------------------------------------------------------- # test_base.sh # ~/projects/ceos/alpine-installer/tests/test_base.sh # Version: v0.0.1 | Status: DEVELOPMENT # Target: Alpine Linux x86-64 (tinkerpad / ThinkPad T480) # --------------------------------------------------------------------------- # Re-runnable test suite for Tier 0 (Base). Run after ce-base.sh. # Exits with count of failures (0 = all passed). # --------------------------------------------------------------------------- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" SCRIPT_NAME="test_base" source "${SCRIPT_DIR}/lib/ce-common.sh" || { echo "ERROR: ce-common.sh not found"; exit 1; } PASS=0 FAIL=0 check() { local desc="${1}" cmd="${2}" if eval "${cmd}" >/dev/null 2>&1; then log_info "PASS: ${desc}" ((PASS++)) else log_warn "FAIL: ${desc}" ((FAIL++)) fi } log_info "=== TEST SUITE: TIER 0 BASE ===" check "bash present" 'command -v bash' check "bash-completion installed" 'apk info -e bash-completion' check "ca-certificates installed" 'apk info -e ca-certificates' check "curl present" 'command -v curl' check "openssh installed" 'apk info -e openssh' check "sshd_config present" '[[ -f /etc/ssh/sshd_config ]]' check "tzdata installed" 'apk info -e tzdata' check "utmps installed" 'apk info -e utmps' check "doas present" 'command -v doas' check "doas wheel.conf present" '[[ -f /etc/doas.d/wheel.conf ]]' check "wheel.conf non-empty" '[[ -s /etc/doas.d/wheel.conf ]]' check "community repo enabled" 'grep -q "^[^#].*community" /etc/apk/repositories' log_info "=== RESULTS: ${PASS} passed, ${FAIL} failed ===" [[ "${FAIL}" -eq 0 ]] \ && log_info "All Tier 0 tests passed." \ || log_warn "${FAIL} test(s) failed — review ${LOG_FILE}" exit "${FAIL}"