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>
44 lines
1.1 KiB
Bash
Executable File
44 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Test: writing through FUSE mount creates a dirty file in VFS
|
|
#
|
|
# Verifies that a file written through the mount point shows up as a
|
|
# pending upload (dirty) in the rclone VFS stats when write-back delay
|
|
# is long enough to observe it.
|
|
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
|
|
|
|
# Generate config with a long write-back delay so the file stays dirty
|
|
gen_config write_back=60s
|
|
|
|
# Start warpgate and wait for readiness
|
|
start_warpgate
|
|
wait_for_mount
|
|
wait_for_rc_api
|
|
|
|
# Write a file through the FUSE mount
|
|
echo "test-write" > "$TEST_MOUNT/written.txt"
|
|
|
|
# Allow a moment for VFS to register the write
|
|
sleep 2
|
|
|
|
# Verify the file is counted as dirty (not yet written back)
|
|
dirty=$(get_dirty_count)
|
|
if [[ "$dirty" -lt 1 ]]; then
|
|
echo "FAIL: expected dirty count > 0, got $dirty" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Verify the file is readable through the mount
|
|
assert_file_content "$TEST_MOUNT/written.txt" "test-write"
|
|
|
|
echo "PASS: $(basename "$0" .sh)"
|