]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add test for missing backup count
authorBastian Dehn <hhaalo@arcor.de>
Tue, 4 Aug 2026 14:05:06 +0000 (16:05 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 4 Aug 2026 14:05:06 +0000 (16:05 +0200)
src/backup
tests/backup_tests.bats

index f6cb00aa7e2a16d636ff152420de9d8d5be844f2..7fd8036449603eae60313e7c33e56c5c31f14467 100755 (executable)
@@ -53,6 +53,11 @@ main()
        [ "$backup_name" != "null" ] \
                || errlog "$CONFIG_FILE missing backup_name" \
                || return $?
+       local backup_count=
+       backup_count=$(echo "$config" | jq --raw-output '.backup_count')
+       [ "$backup_count" != "null" ] \
+               || errlog "$CONFIG_FILE missing backup_count" \
+               || return $?
 }
 
 [ "$TESTMODE" == "ON" ] && return 0
index 9245b2ca08acb83dedb0c545b63b8934278c3bbb..a39a213edc1d0cd872656d9fa416603838a8d721 100755 (executable)
@@ -120,4 +120,18 @@ teardown() {
 
        assert_line --index 0 "⭐ START: backup"
        assert_line --index 1 "❌ ERROR: src/config-example.yaml missing backup_name"
+}
+
+@test "failure no backup count in config" {
+       yq() {
+               echo '{
+                       "backup_path": "path",
+                       "backup_name": "backup"
+                       }'
+       }
+
+       run main
+
+       assert_line --index 0 "⭐ START: backup"
+       assert_line --index 1 "❌ ERROR: src/config-example.yaml missing backup_count"
 }
\ No newline at end of file