diff --git a/acceptance/bundle/variables/file-defaults/output.txt b/acceptance/bundle/variables/file-defaults/output.txt index 73830aae3..5b01a1b66 100644 --- a/acceptance/bundle/variables/file-defaults/output.txt +++ b/acceptance/bundle/variables/file-defaults/output.txt @@ -39,6 +39,37 @@ } } +=== file cannot be parsed +>>> errcode $CLI bundle validate -o json --target invalid_json +Error: failed to parse variables file $TMPDIR/.databricks/bundle/invalid_json/variable-overrides.json: error decoding JSON at :0:0: invalid character 'o' in literal false (expecting 'a') + + +Exit code: 1 +{ + "job_cluster_key": "${var.cluster_key}", + "new_cluster": { + "node_type_id": "${var.cluster.node_type_id}", + "num_workers": "${var.cluster_workers}" + } +} + +=== file has wrong structure +>>> errcode $CLI bundle validate -o json --target wrong_file_structure +Error: failed to parse variables file $TMPDIR/.databricks/bundle/wrong_file_structure/variable-overrides.json: invalid format + +Variables file must be a JSON object with the following format: +{"var1": "value1", "var2": "value2"} + + +Exit code: 1 +{ + "job_cluster_key": "${var.cluster_key}", + "new_cluster": { + "node_type_id": "${var.cluster.node_type_id}", + "num_workers": "${var.cluster_workers}" + } +} + === file has variable that is complex but default is string >>> errcode $CLI bundle validate -o json --target complex_to_string Error: variable cluster_key is not of type complex, but the value in the variable file is a complex type diff --git a/acceptance/bundle/variables/file-defaults/script b/acceptance/bundle/variables/file-defaults/script index c5b208755..8e6fd0d75 100644 --- a/acceptance/bundle/variables/file-defaults/script +++ b/acceptance/bundle/variables/file-defaults/script @@ -14,11 +14,11 @@ trace BUNDLE_VAR_cluster_key=mlops_stacks-cluster-overriden $CLI bundle validate title "variable has value in config file" trace $CLI bundle validate -o json --target with_value | jq $cluster_expr -# title "file cannot be parsed" -# trace errcode $CLI bundle validate -o json --target invalid_json | jq $cluster_expr +title "file cannot be parsed" +trace errcode $CLI bundle validate -o json --target invalid_json | jq $cluster_expr -# title "file has wrong structure" -# trace errcode $CLI bundle validate -o json --target wrong_file_structure | jq $cluster_expr +title "file has wrong structure" +trace errcode $CLI bundle validate -o json --target wrong_file_structure | jq $cluster_expr title "file has variable that is complex but default is string" trace errcode $CLI bundle validate -o json --target complex_to_string | jq $cluster_expr diff --git a/acceptance/bundle/variables/file-defaults/test.toml b/acceptance/bundle/variables/file-defaults/test.toml new file mode 100644 index 000000000..08403b606 --- /dev/null +++ b/acceptance/bundle/variables/file-defaults/test.toml @@ -0,0 +1,8 @@ +# Fix for windows +[[Repls]] +Old = '\$TMPDIR\\.databricks\\bundle\\wrong_file_structure\\variable-overrides.json' +New = '$$TMPDIR/.databricks/bundle/wrong_file_structure/variable-overrides.json' + +[[Repls]] +Old = '\$TMPDIR\\.databricks\\bundle\\invalid_json\\variable-overrides.json' +New = '$$TMPDIR/.databricks/bundle/invalid_json/variable-overrides.json'