Skip to content

Commit 7ca636b

Browse files
Add test for modified_status in bundle summary (#3142)
## Changes Add an acceptance test covering modified_status lifecycle: "created" -> "" -> "deleted". ## Why To support refactoring such as #3134 and direct deployment method support in summary. --------- Co-authored-by: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com>
1 parent 6d67410 commit 7ca636b

File tree

6 files changed

+138
-0
lines changed

6 files changed

+138
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
resources:
2+
pipelines:
3+
my_pipeline:
4+
name: test-pipeline
5+
libraries:
6+
- file:
7+
path: "./foo.py"
8+
9+
schemas:
10+
my_schema:
11+
name: test-schema
12+
catalog_name: main
13+
comment: COMMENT1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bundle:
2+
name: test-bundle
3+
4+
resources: {}

acceptance/bundle/summary/modified_status/foo.py

Whitespace-only changes.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
=== Initial view of resources without id and modified_status=created
3+
>>> [CLI] bundle summary -o json
4+
{
5+
"pipelines": {
6+
"my_pipeline": {
7+
"channel": "CURRENT",
8+
"deployment": {
9+
"kind": "BUNDLE",
10+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json"
11+
},
12+
"edition": "ADVANCED",
13+
"libraries": [
14+
{
15+
"file": {
16+
"path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/foo.py"
17+
}
18+
}
19+
],
20+
"modified_status": "created",
21+
"name": "test-pipeline",
22+
"permissions": []
23+
}
24+
},
25+
"schemas": {
26+
"my_schema": {
27+
"catalog_name": "main",
28+
"comment": "COMMENT1",
29+
"modified_status": "created",
30+
"name": "test-schema"
31+
}
32+
}
33+
}
34+
35+
>>> [CLI] bundle deploy
36+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
37+
Deploying resources...
38+
Updating deployment state...
39+
Deployment complete!
40+
41+
=== Post-deployment view of resources with id and without modified_status
42+
>>> [CLI] bundle summary -o json
43+
{
44+
"pipelines": {
45+
"my_pipeline": {
46+
"channel": "CURRENT",
47+
"deployment": {
48+
"kind": "BUNDLE",
49+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json"
50+
},
51+
"edition": "ADVANCED",
52+
"id": "[UUID]",
53+
"libraries": [
54+
{
55+
"file": {
56+
"path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/foo.py"
57+
}
58+
}
59+
],
60+
"name": "test-pipeline",
61+
"permissions": [],
62+
"url": "[DATABRICKS_URL]/pipelines/[UUID]?o=[NUMID]"
63+
}
64+
},
65+
"schemas": {
66+
"my_schema": {
67+
"catalog_name": "main",
68+
"comment": "COMMENT1",
69+
"id": "main.test-schema",
70+
"name": "test-schema",
71+
"url": "[DATABRICKS_URL]/explore/data/main/test-schema?o=[NUMID]"
72+
}
73+
}
74+
}
75+
76+
=== Expecting all resources to have modified_status=deleted
77+
>>> [CLI] bundle summary -o json
78+
{
79+
"pipelines": {
80+
"my_pipeline": {
81+
"id": "[UUID]",
82+
"modified_status": "deleted",
83+
"url": "[DATABRICKS_URL]/pipelines/[UUID]?o=[NUMID]"
84+
}
85+
},
86+
"schemas": {
87+
"my_schema": {
88+
"id": "main.test-schema",
89+
"modified_status": "deleted",
90+
"url": "[DATABRICKS_URL]/explore/data/main/test-schema?o=[NUMID]"
91+
}
92+
}
93+
}
94+
95+
>>> [CLI] bundle destroy --auto-approve
96+
The following resources will be deleted:
97+
delete pipeline my_pipeline
98+
delete schema my_schema
99+
100+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
101+
102+
Deleting files...
103+
Destroy complete!
104+
105+
>>> [CLI] bundle summary -o json
106+
{}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
title "Initial view of resources without id and modified_status=created"
2+
trace $CLI bundle summary -o json | jq .resources
3+
4+
trace $CLI bundle deploy
5+
6+
title "Post-deployment view of resources with id and without modified_status"
7+
trace $CLI bundle summary -o json | jq .resources
8+
mv empty.yml databricks.yml
9+
10+
title "Expecting all resources to have modified_status=deleted"
11+
trace $CLI bundle summary -o json | jq .resources
12+
13+
trace $CLI bundle destroy --auto-approve
14+
trace $CLI bundle summary -o json | jq .resources
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EnvMatrix.DATABRICKS_CLI_DEPLOYMENT = ["terraform"] # "bundle summary" not implemented for direct deployment

0 commit comments

Comments
 (0)