aboutsummaryrefslogtreecommitdiff
path: root/tests/cases/test_rsync_flags.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-25 09:10:38 -0400
committerCraig Jennings <c@cjennings.net>2026-06-25 09:10:38 -0400
commit3ef8c7a0544f372f0d3c63c8055517e0c64347ec (patch)
tree0ca98245dac009854ca92213e106b1ed8b65123b /tests/cases/test_rsync_flags.sh
parent195833b9db23fd5e5bfdaf17bfae5849e9958a82 (diff)
downloadrsyncshot-3ef8c7a0544f372f0d3c63c8055517e0c64347ec.tar.gz
rsyncshot-3ef8c7a0544f372f0d3c63c8055517e0c64347ec.zip
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.
Diffstat (limited to 'tests/cases/test_rsync_flags.sh')
-rw-r--r--tests/cases/test_rsync_flags.sh29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/cases/test_rsync_flags.sh b/tests/cases/test_rsync_flags.sh
index 768b432..691352d 100644
--- a/tests/cases/test_rsync_flags.sh
+++ b/tests/cases/test_rsync_flags.sh
@@ -36,6 +36,32 @@ test_rsync_flags_numeric_ids_and_relative() {
}
# ------------------------------------------------------------------------------
+# A real backup is quiet: no -v (would balloon the log), uses --info=stats1
+# ------------------------------------------------------------------------------
+test_rsync_flags_backup_quiet() {
+ setup_test_env
+ create_test_config >/dev/null
+ create_test_includes >/dev/null
+ create_test_excludes >/dev/null
+
+ local shim
+ shim=$(make_command_shim rsync)
+
+ PATH="$shim:$PATH" INSTALLHOME="$TEST_CONFIG_DIR" RSYNCSHOT_SKIP_MOUNT_CHECK=1 \
+ LOCKFILE="$TEST_DIR/lock" "$SCRIPT_PATH" manual 1 >/dev/null 2>&1
+
+ local args
+ args=$(cat "$shim/rsync.args" 2>/dev/null)
+
+ assert_contains "$args" "--info=stats1" "real backup should use --info=stats1" || { rm -rf "$shim"; teardown_test_env; return 1; }
+ assert_contains "$args" "-ahR" "real backup flag should be -ahR (relative, no verbose)" || { rm -rf "$shim"; teardown_test_env; return 1; }
+ assert_not_contains "$args" "-avhR" "real backup should not pass -v" || { rm -rf "$shim"; teardown_test_env; return 1; }
+
+ rm -rf "$shim"
+ teardown_test_env
+}
+
+# ------------------------------------------------------------------------------
# Run tests
# ------------------------------------------------------------------------------
run_rsync_flags_tests() {
@@ -43,7 +69,8 @@ run_rsync_flags_tests() {
echo "Running rsync flag tests..."
echo "------------------------------------------------------------"
- run_test "rsync uses --numeric-ids and -R" test_rsync_flags_numeric_ids_and_relative
+ run_test "rsync uses --numeric-ids and -R (dryrun)" test_rsync_flags_numeric_ids_and_relative
+ run_test "real backup is quiet (--info=stats1, no -v)" test_rsync_flags_backup_quiet
}
# Run if executed directly