[ -d "$backup_path/$backup_dir" ] \
|| errlog "directory $backup_path/$backup_dir not exists" \
|| return $?
+ [ -d "$backup_path/$backup_dir/$machine" ] \
+ || errlog "directory $backup_path/$backup_dir/$machine not exists" \
+ || return $?
}
main()
assert_line --index 1 "ℹ️ INFO: backup path build/test"
assert_line --index 2 "ℹ️ INFO: backup name backup"
assert_line --index 3 "❌ ERROR: directory build/test/2000-01-01_01_backup not exists"
+}
+
+# bats test_tags=backup:pathcheck
+@test "failure no backup directory machine" {
+ mkdir --parents "build/test/2000-01-01_01_backup"
+
+ run main -d "2000-01-01" -n "01" -r "testpc1.example.com" -p "/testpath"
+
+ assert_failure
+ assert_line --index 0 "⭐ START: restore"
+ assert_line --index 1 "ℹ️ INFO: backup path build/test"
+ assert_line --index 2 "ℹ️ INFO: backup name backup"
+ assert_line --index 3 "❌ ERROR: directory build/test/2000-01-01_01_backup/testpc1.example.com not exists"
}
\ No newline at end of file