From e092a9e3b123b3e1b5c0c4f8c8a2b9fc4f2d2100 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Tue, 4 Aug 2026 15:55:16 +0200 Subject: [PATCH] add missing backup path test --- src/backup | 6 ++++++ tests/backup_tests.bats | 11 +++++++++++ 2 files changed, 17 insertions(+) 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 -- 2.47.3