From: Bastian Dehn Date: Sun, 16 Aug 2026 18:01:32 +0000 (+0200) Subject: add test for failed delete directory X-Git-Tag: v1.0.7^2~1^2~5 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=fd3b9763818331dd6135128f3c90cbe6fc437ebb;p=simple-backup.git add test for failed delete directory --- diff --git a/src/backupmount b/src/backupmount index 4464114..630130a 100755 --- a/src/backupmount +++ b/src/backupmount @@ -167,7 +167,9 @@ umount_backup() || return $? echo "ℹ️ INFO: remove backup directory $backup_path" - rmdir "$backup_path" + rmdir "$backup_path" \ + || errlog "could not delete directory $backup_path" \ + || return $? } main() diff --git a/tests/backupmount_tests.bats b/tests/backupmount_tests.bats index 67166af..12b4b91 100755 --- a/tests/backupmount_tests.bats +++ b/tests/backupmount_tests.bats @@ -530,4 +530,22 @@ teardown() { assert_line --index 1 "ℹ️ INFO: umount backup path build/test" assert_line --index 2 "ℹ️ INFO: remove backup directory build/test" [ ! -d "build/test" ] +} + +# bats test_tags=backupmount:umount +@test "failure umount remove backup path directory" { + umount() { + return 0 + } + rmdir() { + return 1 + } + + run main "umount" + + assert_failure + assert_line --index 0 "⭐ START: backupmount" + assert_line --index 1 "ℹ️ INFO: umount backup path build/test" + assert_line --index 2 "ℹ️ INFO: remove backup directory build/test" + assert_line --index 3 "❌ ERROR: could not delete directory build/test" } \ No newline at end of file