warpgate/tests/02-lifecycle/test-startup-order.sh
grabbit a2d49137f9 Add comprehensive test suite: 63 integration tests + 110 Rust unit tests
Integration tests (tests/):
- 9 categories covering config, lifecycle, signals, supervision,
  cache, writeback, network faults, crash recovery, and CLI
- Shell-based harness with mock NAS (network namespace + SFTP),
  fault injection (tc netem), and power loss simulation
- TAP format runner (run-all.sh) with proper SKIP detection

Rust unit tests (warpgate/src/):
- 110 tests across 14 modules, all passing in 0.01s
- Config parsing, defaults validation, RestartTracker logic,
  RC API response parsing, rclone arg generation, service
  config generation, CLI output formatting, warmup path logic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:21:35 +08:00

28 lines
823 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/../harness/helpers.sh"
source "$SCRIPT_DIR/../harness/mock-nas.sh"
require_root
setup_test_env
trap teardown_test_env EXIT
# Start the mock NAS so rclone can connect via SFTP
start_mock_nas
# Generate a default config pointing at the mock NAS
gen_config
# Start warpgate and wait for full startup
start_warpgate
wait_for_log_line "Supervision active" 60
# Verify the five startup phases appear in the correct order
assert_log_order "Preflight checks" "Starting rclone mount"
assert_log_order "Starting rclone mount" "Mount ready"
assert_log_order "Mount ready" "Starting protocol services"
assert_log_order "Starting protocol services" "Supervision active"
echo "PASS: $(basename "$0" .sh)"