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>
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Test: cache miss triggers remote file pull into local VFS cache
|
|
#
|
|
# Verifies that reading a file through the FUSE mount for the first time
|
|
# fetches it from the remote NAS via rclone and stores it in $CACHE_DIR/vfs/nas/.
|
|
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 place a 1 MB raw photo file on it
|
|
start_mock_nas
|
|
nas_create_file "photo.cr3" 1024
|
|
|
|
# Generate default config pointing at mock NAS
|
|
gen_config
|
|
|
|
# Start warpgate and wait for mount + RC API readiness
|
|
start_warpgate
|
|
wait_for_mount
|
|
wait_for_rc_api
|
|
|
|
# Verify the file is NOT cached yet
|
|
assert_not_cached "photo.cr3"
|
|
|
|
# Read the file through the FUSE mount (triggers cache-miss pull)
|
|
cat "$TEST_MOUNT/photo.cr3" > /dev/null
|
|
|
|
# Verify the content matches the source file on the NAS
|
|
diff "$TEST_MOUNT/photo.cr3" "$NAS_ROOT/photo.cr3"
|
|
|
|
# Verify the file is now present in the VFS cache
|
|
assert_cached "photo.cr3"
|
|
|
|
echo "PASS: $(basename "$0" .sh)"
|