Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions acceptance/bundle/destroy/delete-error/databricks.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bundle:
name: delete-error-$UNIQUE_NAME

resources:
jobs:
foo:
name: foo-$UNIQUE_NAME
bar:
name: bar-$UNIQUE_NAME
2 changes: 2 additions & 0 deletions acceptance/bundle/destroy/delete-error/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cloud = false
EnvMatrix.DMS = []
36 changes: 36 additions & 0 deletions acceptance/bundle/destroy/delete-error/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/delete-error-[UNIQUE_NAME]/default/files...
Created jobs.bar
Created jobs.foo
Files: 2 uploaded, 0 deleted
Resources: 2 created, 0 changed, 0 deleted, 0 unchanged

=== deploy: removing bar from config, its delete is rejected with 400

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/delete-error-[UNIQUE_NAME]/default/files...
Deleted jobs.bar
Files: 1 uploaded, 0 deleted
Resources: 0 created, 0 changed, 1 deleted, 1 unchanged

>>> [CLI] jobs get [BAR_ID]
json.settings.name = "bar-[UNIQUE_NAME]";

>>> print_state.py
json.state.resources.jobs.foo.__id__ = "[FOO_ID]";

=== destroy: the delete of foo is rejected with 400

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.jobs.foo

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/delete-error-[UNIQUE_NAME]/default

Destroy: 1 deleted

>>> [CLI] jobs get [FOO_ID]
json.settings.name = "foo-[UNIQUE_NAME]";

>>> find.py \.databricks/.*resources.*\.json
19 changes: 19 additions & 0 deletions acceptance/bundle/destroy/delete-error/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
envsubst < databricks.yml.tmpl > databricks.yml
trace $CLI bundle deploy
foo_id=$(read_id.py foo)
bar_id=$(read_id.py bar)

title "deploy: removing bar from config, its delete is rejected with 400"
update_file.py databricks.yml " bar:
name: bar-$UNIQUE_NAME
" ""
fault.py "POST /api/2.2/jobs/delete" 400 0 1 INVALID_PARAMETER_VALUE
errcode trace $CLI bundle deploy
trace $CLI jobs get $bar_id | gron.py | grep settings.name
trace print_state.py | gron.py | grep __id__

title "destroy: the delete of foo is rejected with 400"
fault.py --body-contains "\"job_id\":$foo_id}" "POST /api/2.2/jobs/delete" 400 0 1 INVALID_PARAMETER_VALUE
Comment thread
denik marked this conversation as resolved.
Resolved
errcode trace $CLI bundle destroy --auto-approve
trace $CLI jobs get $foo_id | gron.py | grep settings.name
trace find.py '\.databricks/.*resources.*\.json'
4 changes: 4 additions & 0 deletions acceptance/bundle/destroy/delete-error/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Badness = "When the backend rejects a delete and a re-read does not confirm the resource is gone, deploy and destroy drop the resource from state and succeed, so the job stays in the workspace untracked. They should fail with the delete error and keep the resource in state, as the DMS=true run does."

# The DMS=true run already fails on the rejected delete, so it is excluded until both agree.
EnvMatrix.DMS = []
Loading