Skip to content

Commit 3cdaa75

Browse files
authored
Add a test case for wrong $resources reference (#3481)
1 parent 3955d36 commit 3cdaa75

File tree

9 files changed

+74
-0
lines changed

9 files changed

+74
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resources:
2+
volumes:
3+
bar:
4+
catalog_name: mycatalog
5+
schema_name: myschema
6+
name: barname
7+
foo:
8+
catalog_name: ${resources.volumes.bar.non_existent}
9+
schema_name: ${resources.volumes.bar.schema_name}
10+
name: myname
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
2+
Error: reading config: failed to read references from config for volumes.foo: parsing refs: cannot process reference resources.volumes.bar.non_existent: only ${resources.<group>.<key>.id} references are supported
3+
4+
5+
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/test-bundle/default/files...
2+
Error: exit status 1
3+
4+
Error: Unsupported attribute
5+
6+
on bundle.tf.json line 22, in resource.databricks_volume.foo:
7+
22: "catalog_name": "${databricks_volume.bar.non_existent}",
8+
9+
This object has no argument, nested block, or exported attribute named
10+
"non_existent".
11+
12+
13+
14+
Exit code (musterr): 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Error: reading config: failed to read references from config for volumes.foo: parsing refs: cannot process reference resources.volumes.bar.non_existent: only ${resources.<group>.<key>.id} references are supported
2+
3+
4+
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 22, in resource.databricks_volume.foo:
6+
22: "catalog_name": "${databricks_volume.bar.non_existent}",
7+
8+
This object has no argument, nested block, or exported attribute named
9+
"non_existent".
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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
>>> [CLI] bundle validate -o json
3+
{
4+
"volumes": {
5+
"bar": {
6+
"catalog_name": "mycatalog",
7+
"name": "barname",
8+
"schema_name": "myschema",
9+
"volume_type": "MANAGED"
10+
},
11+
"foo": {
12+
"catalog_name": "${resources.volumes.bar.non_existent}",
13+
"name": "myname",
14+
"schema_name": "${resources.volumes.bar.schema_name}",
15+
"volume_type": "MANAGED"
16+
}
17+
}
18+
}
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)