Skip to content

Commit dfc22cd

Browse files
committed
add missing_map_key test
1 parent 9c0e9ed commit dfc22cd

File tree

9 files changed

+112
-0
lines changed

9 files changed

+112
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
bundle:
2+
name: state
3+
4+
resources:
5+
jobs:
6+
test:
7+
name: "test"
8+
tasks:
9+
- task_key: "test-task"
10+
new_cluster:
11+
custom_tags:
12+
ResourceClass: SingleNode
13+
bar:
14+
name: "test ${resources.jobs.test.tasks[0].new_cluster.custom_tags.missing_tag}"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/state/default/files...
2+
Error: field not set ${resources.jobs.test.tasks[0].new_cluster.custom_tags.missing_tag}: tasks[0].new_cluster.custom_tags.missing_tag: key "missing_tag" not found in map
3+
4+
Error: cannot plan jobs.bar: dependency failed: jobs.test
5+
6+
Error: planning failed
7+
8+
9+
Exit code (musterr): 1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/state/default/files...
2+
Error: exit status 1
3+
4+
Error: Unsupported attribute
5+
6+
on bundle.tf.json line 23, in resource.databricks_job.bar:
7+
23: "name": "test ${databricks_job.test.tasks[0].new_cluster.custom_tags.missing_tag}",
8+
9+
This object has no argument, nested block, or exported attribute named
10+
"tasks". Did you mean "tags"?
11+
12+
13+
14+
Exit code (musterr): 1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Error: field not set ${resources.jobs.test.tasks[0].new_cluster.custom_tags.missing_tag}: tasks[0].new_cluster.custom_tags.missing_tag: key "missing_tag" not found in map
2+
3+
Error: cannot plan jobs.bar: dependency failed: jobs.test
4+
5+
Error: planning failed
6+
7+
8+
Exit code (musterr): 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Error: exit status 1
2+
3+
Error: Unsupported attribute
4+
5+
on bundle.tf.json line 23, in resource.databricks_job.bar:
6+
23: "name": "test ${databricks_job.test.tasks[0].new_cluster.custom_tags.missing_tag}",
7+
8+
This object has no argument, nested block, or exported attribute named
9+
"tasks". Did you mean "tags"?
10+
11+
12+
13+
Exit code (musterr): 1
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
>>> [CLI] bundle validate -o json
3+
{
4+
"jobs": {
5+
"bar": {
6+
"deployment": {
7+
"kind": "BUNDLE",
8+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/state/default/state/metadata.json"
9+
},
10+
"edit_mode": "UI_LOCKED",
11+
"format": "MULTI_TASK",
12+
"max_concurrent_runs": 1,
13+
"name": "test ${resources.jobs.test.tasks[0].new_cluster.custom_tags.missing_tag}",
14+
"permissions": [],
15+
"queue": {
16+
"enabled": true
17+
}
18+
},
19+
"test": {
20+
"deployment": {
21+
"kind": "BUNDLE",
22+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/state/default/state/metadata.json"
23+
},
24+
"edit_mode": "UI_LOCKED",
25+
"format": "MULTI_TASK",
26+
"max_concurrent_runs": 1,
27+
"name": "test",
28+
"permissions": [],
29+
"queue": {
30+
"enabled": true
31+
},
32+
"tasks": [
33+
{
34+
"new_cluster": {
35+
"custom_tags": {
36+
"ResourceClass": "SingleNode"
37+
}
38+
},
39+
"task_key": "test-task"
40+
}
41+
]
42+
}
43+
}
44+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
trace $CLI bundle validate -o json | jq .resources
2+
musterr $CLI bundle plan &> out.plan.$DATABRICKS_CLI_DEPLOYMENT.txt
3+
musterr $CLI bundle deploy &> out.deploy.$DATABRICKS_CLI_DEPLOYMENT.txt
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Badness = "Uploading files even though bundle is wrong; bundle validate does not detect the issue; direct fails but with wrong error message"
2+
RecordRequests = false

0 commit comments

Comments
 (0)