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>
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Test: warmup --newer-than filters files by modification time
|
|
#
|
|
# Verifies that warmup with --newer-than only caches files modified
|
|
# within the specified window, skipping older files. This maps to
|
|
# rclone lsf --max-age under the hood.
|
|
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
|
|
start_mock_nas
|
|
|
|
# Create an old file (timestamp: 2023-01-01) and a new file (now)
|
|
nas_create_file_content "old.txt" "old-content"
|
|
touch -t 202301010000 "$NAS_ROOT/old.txt"
|
|
|
|
nas_create_file_content "new.txt" "new-content"
|
|
|
|
# Generate default config
|
|
gen_config
|
|
|
|
# Start warpgate and wait for readiness
|
|
start_warpgate
|
|
wait_for_mount
|
|
wait_for_rc_api
|
|
|
|
# Run warmup with --newer-than 7d (only files modified in last 7 days)
|
|
run_warpgate_cmd warmup --newer-than 7d ""
|
|
|
|
# Verify the new file is cached
|
|
assert_cached "new.txt"
|
|
|
|
# Verify the old file is NOT cached (older than 7 days)
|
|
assert_not_cached "old.txt"
|
|
|
|
echo "PASS: $(basename "$0" .sh)"
|