Skip to content
Open
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
15 changes: 15 additions & 0 deletions acceptance/bundle/deploy/files/out-of-band-delete/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bundle:
name: out-of-band-delete

resources:
jobs:
foo:
name: test-job
tasks:
- task_key: my_task
spark_python_task:
python_file: ./hello_world.py
new_cluster:
num_workers: 1
spark_version: 13.3.x-snapshot-scala2.12
node_type_id: i3.xlarge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello World!")

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions acceptance/bundle/deploy/files/out-of-band-delete/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

=== After the initial deploy the job's python_file and the deployment state exist
>>> [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py
{
"object_type": "FILE",
"path": "/Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py"
}

>>> [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/state/deployment.json
{
"object_type": "FILE",
"path": "/Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/state/deployment.json"
}

=== Delete the remote bundle directory out-of-band (simulates deleting it in the UI)
>>> [CLI] workspace delete --recursive /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete

=== Redeploy without changing any local file, so the stale sync snapshot is reused
>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

=== After redeploy: the files dir and state are recreated, but the python_file is NOT re-uploaded
>>> errcode [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py
Error: Workspace path not found

Exit code: 1

>>> [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files
{
"object_type": "DIRECTORY",
"path": "/Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files"
}

>>> [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/state/deployment.json
{
"object_type": "FILE",
"path": "/Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/state/deployment.json"
}
31 changes: 31 additions & 0 deletions acceptance/bundle/deploy/files/out-of-band-delete/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Redeploy after the remote bundle directory is deleted out-of-band (e.g. a user
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have Badness in test.toml to mark tests recording a buggy behaviour.

This could also be shortened, for example: "After bundle files deleted remotely, next "bundle deploy" does not reupload them until snapshot.json is removed."

You can also confirm that it's the issue by removing snapshot.json and deploying again.

# deletes it in the workspace UI).
#
# After such a deletion the next "bundle deploy" does not re-upload the bundle files:
# the local sync snapshot still records them as present remotely, and the remote
# deployment state that would otherwise reset the snapshot was deleted too, so the
# file sync computes an empty diff and uploads nothing.
#
# This test pins down the current behaviour: hello_world.py is missing from the
# workspace after the redeploy even though the deploy reports success. If the file
# sync is changed to re-upload in this case, the final get-status will succeed and
# this output is expected to change.

BUNDLE_PATH="/Workspace/Users/${CURRENT_USER_NAME}/.bundle/out-of-band-delete/default"

trace $CLI bundle deploy

title "After the initial deploy the job's python_file and the deployment state exist"
trace $CLI workspace get-status "$BUNDLE_PATH/files/hello_world.py" | jq '{object_type,path}'
trace $CLI workspace get-status "$BUNDLE_PATH/state/deployment.json" | jq '{object_type,path}'

title "Delete the remote bundle directory out-of-band (simulates deleting it in the UI)"
trace $CLI workspace delete --recursive "/Workspace/Users/${CURRENT_USER_NAME}/.bundle/out-of-band-delete"

title "Redeploy without changing any local file, so the stale sync snapshot is reused"
trace $CLI bundle deploy

title "After redeploy: the files dir and state are recreated, but the python_file is NOT re-uploaded"
trace errcode $CLI workspace get-status "$BUNDLE_PATH/files/hello_world.py"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have also 'musterr' to assert that it must fail.

trace $CLI workspace get-status "$BUNDLE_PATH/files" | jq '{object_type,path}'
trace $CLI workspace get-status "$BUNDLE_PATH/state/deployment.json" | jq '{object_type,path}'
Loading