From: Bastian Dehn Date: Mon, 17 Aug 2026 17:57:58 +0000 (+0200) Subject: add test for rsync with dir mode X-Git-Tag: v1.0.8^2~1 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=00f1b412c22a9efaf51cbba3a835827f15dd6b5c;p=simple-backup.git add test for rsync with dir mode --- diff --git a/tests/restore_tests.bats b/tests/restore_tests.bats index cba39c9..6d43399 100755 --- a/tests/restore_tests.bats +++ b/tests/restore_tests.bats @@ -533,6 +533,36 @@ teardown() { assert_equal "$(awk 'NR==11 {print; exit}' "$RSYNC_LOG")" "backupuser@www.example.com:/testpath/testfile" } +# bats test_tags=restore:rsync, restore:origin +@test "success backup machine path rsync parameter delete dir mode" { + mkdir --parents "build/test/2000-01-01_01_backup/testpc1.example.com/testpath/dir" + RSYNC_LOG_RUNS="1" + + run main -d "2000-01-01" -n "01" -r "testpc1.example.com" -p "/testpath/dir/" -o + + assert_success + assert_line --index 0 "⭐ START: restore" + assert_line --index 1 "ℹ️ INFO: backup path build/test" + assert_line --index 2 "ℹ️ INFO: backup name backup" + assert_line --index 3 "ℹ️ INFO: restore mode directory" + assert_line --index 4 "ℹ️ INFO: restore path build/test/2000-01-01_01_backup/testpc1.example.com/testpath/dir/" + assert_line --index 5 "ℹ️ INFO: remote path backupuser@www.example.com:/testpath/dir/" + assert_line --index 6 "⚠️ WARN: DELETE MODE IS ON" + assert_line --index 7 "❓ QUESTION: Do you want restore? [N/y]" + assert_line --index 8 "✅ SUCCESS: restore" + assert_equal "$(awk 'NR==1 {print; exit}' "$RSYNC_LOG")" "10" + assert_equal "$(awk 'NR==2 {print; exit}' "$RSYNC_LOG")" "--archive" + assert_equal "$(awk 'NR==3 {print; exit}' "$RSYNC_LOG")" "--verbose" + assert_equal "$(awk 'NR==4 {print; exit}' "$RSYNC_LOG")" "--sparse" + assert_equal "$(awk 'NR==5 {print; exit}' "$RSYNC_LOG")" "--acls" + assert_equal "$(awk 'NR==6 {print; exit}' "$RSYNC_LOG")" "--hard-links" + assert_equal "$(awk 'NR==7 {print; exit}' "$RSYNC_LOG")" "--human-readable" + assert_equal "$(awk 'NR==8 {print; exit}' "$RSYNC_LOG")" "--delete" + assert_equal "$(awk 'NR==9 {print; exit}' "$RSYNC_LOG")" "--rsh=ssh -p 22" + assert_equal "$(awk 'NR==10 {print; exit}' "$RSYNC_LOG")" "build/test/2000-01-01_01_backup/testpc1.example.com/testpath/dir/" + assert_equal "$(awk 'NR==11 {print; exit}' "$RSYNC_LOG")" "backupuser@www.example.com:/testpath/dir/" +} + # bats test_tags=restore:rsync, restore:origin @test "success show help useage" { mkdir --parents "build/test/2000-01-01_01_backup/testpc1.example.com/testpath"