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>
36 lines
841 B
Bash
Executable File
36 lines
841 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 mock NAS and create a test file for warmup to pull
|
|
start_mock_nas
|
|
nas_create_file "photos/test.jpg" 4
|
|
|
|
# Generate config with auto-warmup enabled and a warmup rule for the path
|
|
gen_config warmup_auto=true \
|
|
'warmup.rules=[[warmup.rules]]
|
|
path = ""
|
|
'
|
|
|
|
start_warpgate
|
|
|
|
# Wait for the warmup phase to begin
|
|
wait_for_log_line "Running auto-warmup" 60
|
|
|
|
# Warmup ran successfully
|
|
assert_log_contains "Running auto-warmup"
|
|
|
|
# Wait for warmup to complete and verify the file actually entered cache
|
|
wait_for_mount 60
|
|
wait_for_rc_api 30
|
|
sleep 5
|
|
assert_cached "photos/test.jpg"
|
|
|
|
echo "PASS: $(basename "$0" .sh)"
|