echo "ℹ️ INFO: backup count $backup_count"
}
+exists_machines()
+{
+ local config="$1"
+ echo "$config" | jq --exit-status '.machines' > /dev/null \
+ || errlog "$CONFIG_FILE missing machines" \
+ || return $?
+}
+
get_last_backup_dir_path()
{
local config="$1"
exists_backup_path "$config" || return $?
exists_backup_name "$config" || return $?
exists_backup_count "$config" || return $?
+ exists_machines "$config" || return $?
last_backup_dir_path=$(get_last_backup_dir_path "$config")
[ -n "$last_backup_dir_path" ] \
assert_line --index 3 "❌ ERROR: src/config-example.yaml missing backup_count"
}
+@test "failure no machines in config" {
+ yq() {
+ echo '{
+ "backup_path": "path",
+ "backup_name": "backup",
+ "backup_count": 15
+ }'
+ }
+
+ run main
+
+ assert_failure
+ assert_line --index 0 "⭐ START: backup"
+ assert_line --index 1 "ℹ️ INFO: backup path path"
+ assert_line --index 2 "ℹ️ INFO: backup name backup"
+ assert_line --index 3 "ℹ️ INFO: backup count 15"
+ assert_line --index 4 "❌ ERROR: src/config-example.yaml missing machines"
+}
+
@test "success info backup count" {
create_backup_dir() {
: