#!/usr/bin/env bash # Test: `warpgate status` when warpgate is running shows mount UP and cache stats # # Verifies that `status` reports "Mount: UP" and includes basic cache/speed # statistics when the daemon is fully operational. 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 rclone can connect via SFTP start_mock_nas # Generate config pointing at mock NAS gen_config # Start warpgate and wait for mount + RC API readiness start_warpgate wait_for_mount 60 wait_for_rc_api 30 # Run the status subcommand output=$(run_warpgate_cmd status) # Verify status reports the mount as UP — check as a single combined string assert_output_contains "$output" "Mount: UP" # Verify output includes some stats (cache size, speed, etc.) if echo "$output" | grep -q "Cache:\|Speed:"; then true else echo "FAIL: status output missing expected stats (Cache: or Speed:)" >&2 echo " output: $output" >&2 exit 1 fi echo "PASS: $(basename "$0" .sh)"