warpgate/tests/01-config/test-extreme-values.sh
grabbit a2d49137f9 Add comprehensive test suite: 63 integration tests + 110 Rust unit tests
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>
2026-02-18 11:21:35 +08:00

31 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"
setup_test_env
trap teardown_test_env EXIT
# Generate a full config and then override several fields with extreme
# (but syntactically valid) values to confirm the binary does not panic.
source "$HARNESS_DIR/config-gen.sh"
_gen_config \
cache.max_size="999T" \
writeback.transfers=999 \
connection.sftp_connections=999
# The binary should parse the config successfully and not panic.
# `status` will report DOWN (no mount running) but should exit 0.
output=$("$WARPGATE_BIN" status -c "$TEST_CONFIG" 2>&1) || {
echo "FAIL: warpgate status exited non-zero with extreme values"
echo " output: $output"
exit 1
}
# Verify the extreme values actually made it into the config file.
assert_output_contains "$(cat "$TEST_CONFIG")" '999T'
assert_output_contains "$(cat "$TEST_CONFIG")" 'transfers = 999'
assert_output_contains "$(cat "$TEST_CONFIG")" 'sftp_connections = 999'
echo "PASS: $(basename "$0" .sh)"