From: Bastian Dehn Date: Tue, 4 Aug 2026 13:55:16 +0000 (+0200) Subject: add missing backup path test X-Git-Tag: v1.0.6^2~1^2~72 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=e092a9e3b123b3e1b5c0c4f8c8a2b9fc4f2d2100;p=simple-backup.git add missing backup path test --- diff --git a/src/backup b/src/backup index 9147a7c..dd15734 100755 --- a/src/backup +++ b/src/backup @@ -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 diff --git a/tests/backup_tests.bats b/tests/backup_tests.bats index 32b5635..2149f2e 100755 --- a/tests/backup_tests.bats +++ b/tests/backup_tests.bats @@ -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