]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
no cleanup by max backup count
authorBastian Dehn <hhaalo@arcor.de>
Tue, 11 Aug 2026 18:48:28 +0000 (20:48 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 11 Aug 2026 18:48:28 +0000 (20:48 +0200)
src/backup
tests/backup_tests.bats

index feec5e88a0e36203062713c4aeb17c74c35f09eb..f84ef410e1df3472408041edc1c9d5dd183ca5a6 100755 (executable)
@@ -329,7 +329,7 @@ cleanup_old_backups()
        backup_path=$(echo "$config" | jq --raw-output '.backup_path')
        backup_name=$(echo "$config" | jq --raw-output '.backup_name')
 
-       [ "$count" -lt "$max_count" ] \
+       [ "$count" -le "$max_count" ] \
                && echo "ℹ️ INFO: no backup to cleanup" \
                && return 0
 
index e180310a80624fcf81d2dd9e8bbc36f0a92a52a1..550f3ca4f9bee140f31bd82fbf6b8c6327c2f6f7 100755 (executable)
@@ -780,6 +780,20 @@ teardown() {
        assert_line --partial "ℹ️ INFO: no backup to cleanup"
 }
 
+# bats test_tags=backup:info,backup:cleanup
+@test "success no backup to cleanup info by max backups" {
+       local num=
+       for i in {1..14}; do
+               num=$(printf "%02d" "$i")
+               mkdir --parents "build/test/1999-10-${num}_01_backup"
+       done
+       run main
+
+       assert_success
+       assert_line --index 0 "⭐ START: backup"
+       assert_line --partial "ℹ️ INFO: no backup to cleanup"
+}
+
 # bats test_tags=backup:info,backup:cleanup
 @test "success cleanup one backup" {
        local num=