#!/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" require_root setup_test_env trap teardown_test_env EXIT # Start the mock NAS so the connection is reachable, but configure warpgate # with a WRONG key file so rclone fails with "auth failed" (not "connection # refused"). This tests the auth-failure fast-exit path. start_mock_nas # Generate a second SSH key that is NOT in authorized_keys ssh-keygen -t ed25519 -f "$TEST_DIR/wrong_key" -N "" -q gen_config nas_key_file="$TEST_DIR/wrong_key" start_warpgate # rclone should fail fast; allow up to 10s for warpgate to detect and exit wait_for_exit "$WARPGATE_PID" 10 # Verify the immediate-exit message appeared in the log assert_log_contains "rclone mount exited immediately" echo "PASS: $(basename "$0" .sh)"