From 3ef8c7a0544f372f0d3c63c8055517e0c64347ec Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 25 Jun 2026 09:10:38 -0400 Subject: fix: graceful remote skip, quieter backups, accurate snapshot counts A scheduled backup to an unreachable remote now skips (exit 0) instead of erroring, so cron stops logging a failure when the NAS or laptop is offline. Authentication and host-key failures still error loudly, so a genuinely broken backup isn't masked as offline. The actual backup drops rsync -v for --info=stats1, so the logfile gets a per-run summary instead of every transferred file path. The dryrun stays verbose. list and status no longer count the latest/ working directory as a snapshot. Snapshot directories are now read-only beyond the top level (find -type d). Only directories are touched, never the hard-linked files, so permissions don't ripple across snapshots. Previously-unchecked rotation steps (orphan cleanup, the latest/ touch, the read-only chmod) now warn instead of failing silently. The remote snapshot listing falls back to BSD stat when GNU stat isn't available. --- tests/cases/test_remote.sh | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'tests/cases/test_remote.sh') diff --git a/tests/cases/test_remote.sh b/tests/cases/test_remote.sh index c2ee75e..d623009 100644 --- a/tests/cases/test_remote.sh +++ b/tests/cases/test_remote.sh @@ -37,6 +37,30 @@ EOF teardown_test_env } +# ------------------------------------------------------------------------------ +# An unreachable remote skips gracefully (exit 0), not an error +# ------------------------------------------------------------------------------ +# Needs no real remote: an unresolvable .invalid host makes the SSH check fail, +# so this runs unconditionally (not behind the localhost gate). +test_remote_unreachable_skips_gracefully() { + setup_test_env + cat > "$TEST_CONFIG_DIR/config" </dev/null + create_test_excludes >/dev/null + + local output rc + output=$(INSTALLHOME="$TEST_CONFIG_DIR" LOCKFILE="$TEST_DIR/lock" "$SCRIPT_PATH" manual 1 2>&1) + rc=$? + + teardown_test_env + + assert_exit_code 0 "$rc" "unreachable remote should skip gracefully (exit 0)" || return 1 + assert_contains "$output" "unreachable" "should log the unreachable skip" || return 1 +} + # ------------------------------------------------------------------------------ # Run tests # ------------------------------------------------------------------------------ @@ -45,8 +69,10 @@ run_remote_tests() { echo "Running remote (SSH) tests..." echo "------------------------------------------------------------" + run_test "unreachable remote skips gracefully" test_remote_unreachable_skips_gracefully + if ! remote_available; then - echo " SKIP: root cannot ssh to localhost with key auth — skipping remote tests" + echo " SKIP: root cannot ssh to localhost with key auth — skipping live remote tests" return 0 fi -- cgit v1.2.3