Skip to content

Commit de689a8

Browse files
committed
Distinguish resources removed from state in bundle summaries
1 parent b3ba429 commit de689a8

23 files changed

Lines changed: 157 additions & 31 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bundle:
2+
name: test-deploy-summary-on-error

‎acceptance/bundle/deploy/summary-on-error/output.txt‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,21 @@ API message: Fault injected by test.
1515

1616
Error: cannot create resources.jobs.job_03: dependency failed: resources.jobs.job_02
1717

18-
Files: 1 uploaded, 0 deleted
18+
Files: 2 uploaded, 0 deleted
1919
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 2 failed
20+
21+
=== Removing a resource whose delete is denied reports state removal
22+
23+
>>> fault.py POST /api/2.2/jobs/delete 403 0 1 PERMISSION_DENIED
24+
25+
>>> [CLI] bundle deploy
26+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-deploy-summary-on-error/default/files...
27+
Warn: destroying resources.jobs.job_01: Ignoring permission error when deleting resources.jobs.job_01 id=[JOB_01_ID]: Fault injected by test.
28+
Removed jobs.job_01 from state
29+
Files: 1 uploaded, 0 deleted
30+
Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 removed from state
31+
32+
>>> [CLI] jobs get [JOB_01_ID]
33+
{
34+
"name": "job-01"
35+
}

‎acceptance/bundle/deploy/summary-on-error/script‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ title "Deploy three chained jobs; the second create fails"
44
# reports the accurate counts (1 created, 2 failed) rather than the planned 3 created.
55
trace fault.py "POST /api/2.2/jobs/create" 400 1 1 INVALID_PARAMETER_VALUE
66
trace musterr $CLI bundle deploy
7+
8+
title "Removing a resource whose delete is denied reports state removal"
9+
job_id=$(read_id.py job_01)
10+
cp databricks-empty.yml databricks.yml
11+
trace fault.py "POST /api/2.2/jobs/delete" 403 0 1 PERMISSION_DENIED
12+
trace $CLI bundle deploy
13+
trace $CLI jobs get "$job_id" | jq '{name: .settings.name}'

‎acceptance/bundle/destroy/summary-on-error/output.txt‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,48 @@ API error_code: INVALID_PARAMETER_VALUE
2929
API message: Fault injected by test.
3030

3131
Destroy: 2 deleted, 1 failed
32+
33+
=== A permission-denied delete removes state without reporting a deletion
34+
35+
>>> fault.py POST /api/2.2/jobs/delete 403 0 1 PERMISSION_DENIED
36+
37+
>>> [CLI] bundle destroy --auto-approve
38+
The following resources will be deleted:
39+
delete resources.jobs.job_01
40+
41+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-destroy-summary-on-error/default
42+
43+
Warn: destroying resources.jobs.job_01: Ignoring permission error when deleting resources.jobs.job_01 id=[JOB_01_ID]: Fault injected by test.
44+
Destroy: 0 deleted, 1 removed from state
45+
46+
>>> [CLI] jobs get [JOB_01_ID]
47+
{
48+
"name": "job-01"
49+
}
50+
51+
=== Without deployment history, ignored delete errors also report state removal
52+
53+
>>> [CLI] bundle deploy
54+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-destroy-summary-on-error/default/files...
55+
Created jobs.job_01
56+
Created jobs.job_02
57+
Created jobs.job_03
58+
Files: 1 uploaded, 0 deleted
59+
Resources: 3 created, 0 changed, 0 deleted, 0 unchanged
60+
61+
>>> fault.py POST /api/2.2/jobs/delete 400 2 1 INVALID_PARAMETER_VALUE
62+
63+
>>> [CLI] bundle destroy --auto-approve
64+
The following resources will be deleted:
65+
delete resources.jobs.job_01
66+
delete resources.jobs.job_02
67+
delete resources.jobs.job_03
68+
69+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-destroy-summary-on-error/default
70+
71+
Destroy: 2 deleted, 1 removed from state
72+
73+
>>> [CLI] jobs get [JOB_01_ID_3]
74+
{
75+
"name": "job-01"
76+
}

‎acceptance/bundle/destroy/summary-on-error/script‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,26 @@ title "Deploy three chained jobs"
22
trace $CLI bundle deploy
33
# Mask the job IDs (the destroy error below prints job_01's) so the golden is stable.
44
replace_ids.py
5+
job_id=$(read_id.py job_01)
56

67
title "Destroy: report two successful deletions and one failure"
78
# Deletes run children-first (job_03, job_02, job_01); faulting the third makes only
89
# job_01 fail while job_03 and job_02 are really deleted. The deferred summary must
910
# report those completed deletions even though destroy returns an error.
1011
trace fault.py "POST /api/2.2/jobs/delete" 400 2 1 INVALID_PARAMETER_VALUE
1112
trace musterr $CLI bundle destroy --auto-approve
13+
14+
title "A permission-denied delete removes state without reporting a deletion"
15+
trace fault.py "POST /api/2.2/jobs/delete" 403 0 1 PERMISSION_DENIED
16+
trace $CLI bundle destroy --auto-approve
17+
trace $CLI jobs get "$job_id" | jq '{name: .settings.name}'
18+
19+
title "Without deployment history, ignored delete errors also report state removal"
20+
# The previous destroy removed the deployment, so this starts fresh without history.
21+
export DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false
22+
trace $CLI bundle deploy
23+
replace_ids.py
24+
job_id=$(read_id.py job_01)
25+
trace fault.py "POST /api/2.2/jobs/delete" 400 2 1 INVALID_PARAMETER_VALUE
26+
trace $CLI bundle destroy --auto-approve
27+
trace $CLI jobs get "$job_id" | jq '{name: .settings.name}'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# fault.py registers its rule on the fake server, which a real workspace does not have.
22
Cloud = false
33

4-
# A failed resource delete only surfaces as a destroy error with deployment
5-
# history enabled, so pin that variant to exercise the error path deterministically.
4+
# Start with history enabled to surface a delete error; the script also exercises
5+
# ignored delete errors after disabling history for a fresh deployment.
66
EnvMatrix.DMS = ["true"]
77

88
Ignore = [".databricks"]

‎acceptance/bundle/resources/materialization_sets/settled_failure/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ Deleting a Feature View that a FeatureSpec serves is not blocked, and leaves the
5555

5656
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-matset-settled-[UNIQUE_NAME]/default
5757

58-
Destroy: 3 deleted
58+
Destroy: 2 deleted, 1 removed from state

‎acceptance/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/out.destroy.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ The following resources will be deleted:
77
All files and directories at the following location will be deleted: /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/default
88

99
Warn: destroying resources.jobs.foo: Ignoring permission error when deleting resources.jobs.foo id=[FOO_ID]: User [TEST_SP_APPLICATION_ID] does not have Admin or Owner permissions on job [FOO_ID]
10-
Destroy: 1 deleted
10+
Destroy: 0 deleted, 1 removed from state

‎acceptance/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/out.destroy.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ The following resources will be deleted:
77
All files and directories at the following location will be deleted: /Workspace/Users/[TEST_SP_APPLICATION_ID]/.bundle/test-bundle-[UNIQUE_NAME]/default
88

99
Warn: destroying resources.jobs.foo: Ignoring permission error when deleting resources.jobs.foo id=[FOO_ID]: User [TEST_SP_APPLICATION_ID] does not have Admin or Owner permissions on job [FOO_ID]
10-
Destroy: 1 deleted
10+
Destroy: 0 deleted, 1 removed from state

‎acceptance/bundle/resources/postgres_branches/replace_existing/out.destroy.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ All data stored in them will be permanently lost:
1212

1313
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-replace-branch-[UNIQUE_NAME]/default
1414

15-
Destroy: 2 deleted
15+
Destroy: 1 deleted, 1 removed from state

0 commit comments

Comments
 (0)