Skip to content

Commit 024c840

Browse files
Address review feedback: fix lint, regen schema, add acceptance tests
- Add nolint comment for Id field collision between BaseResource and apps.Space (same pattern as App resource) - Regenerate annotations.yml and jsonschema.json via make schema - Add acceptance tests: basic (with nested resources), recreate (name immutability), update (create/update/rename/destroy lifecycle) Co-authored-by: Isaac
1 parent 29834bc commit 024c840

21 files changed

Lines changed: 429 additions & 1 deletion
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
bundle:
2+
name: test-bundle
3+
4+
resources:
5+
app_spaces:
6+
mykey:
7+
name: myspacename
8+
description: my_space_description
9+
resources:
10+
- name: my-serving-endpoint
11+
serving_endpoint:
12+
name: my-endpoint
13+
permission: CAN_QUERY
14+
- name: my-warehouse
15+
sql_warehouse:
16+
id: warehouse-id-1
17+
permission: CAN_USE
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"body": {
3+
"description": "my_space_description",
4+
"name": "myspacename",
5+
"resources": [
6+
{
7+
"name": "my-serving-endpoint",
8+
"serving_endpoint": {
9+
"name": "my-endpoint",
10+
"permission": "CAN_QUERY"
11+
}
12+
},
13+
{
14+
"name": "my-warehouse",
15+
"sql_warehouse": {
16+
"id": "warehouse-id-1",
17+
"permission": "CAN_USE"
18+
}
19+
}
20+
]
21+
},
22+
"method": "POST",
23+
"path": "/api/2.0/app-spaces"
24+
}
25+
{
26+
"method": "DELETE",
27+
"path": "/api/2.0/app-spaces/myspacename"
28+
}

acceptance/bundle/resources/app_spaces/basic/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
>>> [CLI] bundle validate
3+
Name: test-bundle
4+
Target: default
5+
Workspace:
6+
User: [USERNAME]
7+
Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
8+
9+
Validation OK!
10+
11+
>>> [CLI] bundle plan
12+
create app_spaces.mykey
13+
14+
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
15+
16+
>>> [CLI] bundle deploy
17+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
18+
Deploying resources...
19+
Updating deployment state...
20+
Deployment complete!
21+
22+
>>> print_requests
23+
24+
>>> [CLI] bundle summary
25+
Name: test-bundle
26+
Target: default
27+
Workspace:
28+
User: [USERNAME]
29+
Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
30+
Resources:
31+
App Spaces:
32+
mykey:
33+
Name: myspacename
34+
URL: (not deployed)
35+
36+
>>> [CLI] bundle destroy --auto-approve
37+
The following resources will be deleted:
38+
delete resources.app_spaces.mykey
39+
40+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
41+
42+
Deleting files...
43+
Destroy complete!
44+
45+
>>> print_requests
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
print_requests() {
2+
jq --sort-keys 'select(.method != "GET" and (.path | contains("/app-spaces")))' < out.requests.txt
3+
rm out.requests.txt
4+
}
5+
6+
trace $CLI bundle validate
7+
trace $CLI bundle plan
8+
trace $CLI bundle deploy
9+
trace print_requests > out.requests.$DATABRICKS_BUNDLE_ENGINE.json
10+
trace $CLI bundle summary
11+
trace $CLI bundle destroy --auto-approve
12+
trace print_requests >> out.requests.$DATABRICKS_BUNDLE_ENGINE.json
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_BUNDLE_ENGINE = ["direct"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bundle:
2+
name: test-bundle
3+
4+
resources:
5+
app_spaces:
6+
mykey:
7+
name: original-space-name
8+
description: my_space_description
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"body": {
3+
"description": "my_space_description",
4+
"name": "original-space-name"
5+
},
6+
"method": "POST",
7+
"path": "/api/2.0/app-spaces"
8+
}

acceptance/bundle/resources/app_spaces/recreate/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
>>> [CLI] bundle plan
3+
create app_spaces.mykey
4+
5+
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
6+
7+
>>> [CLI] bundle deploy
8+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
9+
Deploying resources...
10+
Updating deployment state...
11+
Deployment complete!
12+
13+
>>> print_requests
14+
15+
=== Change name (immutable field - should recreate)
16+
>>> update_file.py databricks.yml original-space-name renamed-space
17+
File "<fstring>", line 1
18+
(old=)
19+
^
20+
SyntaxError: invalid syntax
21+
22+
Exit code: 1

0 commit comments

Comments
 (0)