]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add missing backup path test
authorBastian Dehn <hhaalo@arcor.de>
Tue, 4 Aug 2026 13:55:16 +0000 (15:55 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 4 Aug 2026 13:55:32 +0000 (15:55 +0200)
src/backup
tests/backup_tests.bats

index 9147a7c29a55d4628ded59d18ea0eff8e7670ca0..dd15734f2823c2fd908e43f80e90b50f92b33424 100755 (executable)
@@ -42,6 +42,12 @@ main()
        config=$(yq '.' "$CONFIG_FILE") \
                || errlog "failed to load $CONFIG_FILE" \
                || return $?
+
+       local backup_path=
+       backup_path=$(echo "$config" | jq --raw-output '.backup_path')
+       [ "$backup_path" != "null" ] \
+               || errlog "$CONFIG_FILE missing backup_path" \
+               || return $?
 }
 
 [ "$TESTMODE" == "ON" ] && return 0
index 32b5635001e9267da26f08438139c7f83fa6e819..2149f2eb950d7ba60761a4a3124dd10f94308dc1 100755 (executable)
@@ -98,4 +98,15 @@ teardown() {
 
        assert_line --index 0 "⭐ START: backup"
        assert_line --index 1 "❌ ERROR: failed to load src/config-example.yaml"
+}
+
+@test "failure no backup path in config" {
+       yq() {
+               echo "{}"
+       }
+
+       run main
+
+       assert_line --index 0 "⭐ START: backup"
+       assert_line --index 1 "❌ ERROR: src/config-example.yaml missing backup_path"
 }
\ No newline at end of file