2025-01-17 17:32:38 +00:00
|
|
|
cluster_expr=".resources.jobs.job1.job_clusters[0]"
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "variable file"
|
2025-01-17 17:32:38 +00:00
|
|
|
trace $CLI bundle validate -o json --var-file=var_files/normal.json | jq $cluster_expr
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "default variable file (see .databricks/*)"
|
2025-01-21 17:00:39 +00:00
|
|
|
trace $CLI bundle validate -o json --target with-default-variable-file | jq $cluster_expr
|
2025-01-17 17:32:38 +00:00
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "variable file and variable flag"
|
2025-01-21 17:00:39 +00:00
|
|
|
trace $CLI bundle validate -o json --var-file=var_files/normal.json --var="cluster_key=mlops_stacks-cluster-overriden" | jq $cluster_expr
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "variable file and environment variable"
|
2025-01-21 17:00:39 +00:00
|
|
|
trace BUNDLE_VAR_cluster_key=incorrectly-overriden $CLI bundle validate -o json --var-file=var_files/normal.json | jq $cluster_expr
|
2025-01-17 17:32:38 +00:00
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "file not found"
|
2025-01-21 10:39:18 +00:00
|
|
|
trace errcode $CLI bundle validate -o json --var-file=var_files/not_found.json 2> >(sed 's/\(Error: failed to read variables file: open var_files\/not_found.json:\).*/\1<stripped>/' >&2) > tmp.txt
|
|
|
|
jq "$cluster_expr" tmp.txt
|
2025-01-17 17:32:38 +00:00
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "file cannot be parsed"
|
2025-01-17 17:32:38 +00:00
|
|
|
trace errcode $CLI bundle validate -o json --var-file=var_files/invalid_json.json | jq $cluster_expr
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "file has wrong structure"
|
2025-01-17 17:32:38 +00:00
|
|
|
trace errcode $CLI bundle validate -o json --var-file=var_files/wrong_file_structure.json | jq $cluster_expr
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "file has variable name that is not defined"
|
2025-01-17 17:32:38 +00:00
|
|
|
trace errcode $CLI bundle validate -o json --var-file=var_files/undeclared.json | jq $cluster_expr
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "file has variable name that is complex but default is string"
|
2025-01-17 17:32:38 +00:00
|
|
|
trace errcode $CLI bundle validate -o json --var-file=var_files/complex_to_string.json | jq $cluster_expr
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "file has variable name that is string but default is complex"
|
2025-01-17 17:32:38 +00:00
|
|
|
trace errcode $CLI bundle validate -o json --var-file=var_files/string_to_complex.json | jq $cluster_expr
|
|
|
|
|
2025-01-21 17:16:06 +00:00
|
|
|
title "variable is required but it's not provided in the file"
|
2025-01-20 11:37:43 +00:00
|
|
|
trace errcode $CLI bundle validate -o json --target without-defaults --var-file=var_files/without_required.json | jq $cluster_expr
|