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.0 KiB
Bash
Executable File
44 lines
1.0 KiB
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"
|
|
|
|
# Test: concurrent writes are all written back correctly.
|
|
# 10 files written in parallel background subshells should all drain
|
|
# and arrive on the NAS with correct content.
|
|
|
|
require_root
|
|
setup_test_env
|
|
trap teardown_test_env EXIT
|
|
|
|
start_mock_nas
|
|
|
|
gen_config write_back=2s transfers=4
|
|
|
|
start_warpgate
|
|
wait_for_mount
|
|
wait_for_rc_api
|
|
|
|
# Write 10 files concurrently in background subshells
|
|
pids=()
|
|
for i in $(seq 1 10); do
|
|
(echo "concurrent-data-$i" > "$TEST_MOUNT/concurrent-$i.txt") &
|
|
pids+=($!)
|
|
done
|
|
|
|
# Wait for all write subshells to complete
|
|
for pid in "${pids[@]}"; do
|
|
wait "$pid"
|
|
done
|
|
|
|
# Wait for all dirty files to drain
|
|
wait_for_dirty_zero 60
|
|
|
|
# Verify all 10 files arrived on the NAS with correct content
|
|
for i in $(seq 1 10); do
|
|
assert_file_content "$NAS_ROOT/concurrent-$i.txt" "concurrent-data-$i"
|
|
done
|
|
|
|
echo "PASS: $(basename "$0" .sh)"
|