]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add rsync failure error
authorBastian Dehn <hhaalo@arcor.de>
Thu, 6 Aug 2026 17:05:48 +0000 (19:05 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 6 Aug 2026 17:05:48 +0000 (19:05 +0200)
src/backup
tests/backup_tests.bats

index 2528484410185535a77d5f617195b1db986e5f9d..fb5a0171c28531b4d6719bb847d85be393b0374b 100755 (executable)
@@ -176,7 +176,9 @@ path_backup()
        rsyncargs+=("$hostpath")
        rsyncargs+=("$full_backup_path")
 
-       rsync "${rsyncargs[@]}"
+       rsync "${rsyncargs[@]}" \
+               || errlog "could not backup $machine with path $path" \
+               || return $?
 }
 
 machine_backup_pathes()
index 023ff9d44676b9bd41a1f854d89e2738bee3f664..aad412574673a5cf872cb29957d97ad29f4a8e17 100755 (executable)
@@ -560,4 +560,15 @@ teardown() {
        assert_equal "$(awk 'NR==9 {print; exit}' "$RSYNC_LOG")" "--rsh=\"ssh -p 22\""
        assert_equal "$(awk 'NR==10 {print; exit}' "$RSYNC_LOG")" "/home/local"
        assert_equal "$(awk 'NR==11 {print; exit}' "$RSYNC_LOG")" "build/2000-01-01_01_backup/onlylocal"
+}
+
+@test "failure backup machine path rsync failed" {
+       rsync() {
+               return 1
+       }
+       run main
+
+       assert_failure
+       assert_line --index 0 "⭐ START: backup"
+       assert_line --partial "❌ ERROR: could not backup testpc1 with path /etc"
 }
\ No newline at end of file