#!/usr/bin/env bash # Test: `warpgate status` when warpgate is NOT running shows DOWN # # Verifies that `status` exits 0 and reports a down/not-mounted state when # no warpgate daemon is running. The status command should never crash # even when the RC API is unavailable. 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 config but do NOT start warpgate gen_config # Run the status subcommand — must not fail exit_code=0 output=$(run_warpgate_cmd status) || exit_code=$? # Verify exit code is 0 (status always succeeds, even when mount is down) if [[ "$exit_code" -ne 0 ]]; then echo "FAIL: status exited with code $exit_code (expected 0)" >&2 echo " output: $output" >&2 exit 1 fi # Verify output indicates the mount is not active if echo "$output" | grep -qi "DOWN\|not active\|not mounted"; then true else echo "FAIL: status output does not indicate mount is down" >&2 echo " output: $output" >&2 exit 1 fi echo "PASS: $(basename "$0" .sh)"