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
112 changes: 112 additions & 0 deletions acceptance/bundle/resources/pipelines/testing/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,115 @@
}
]
}

=== Deploy sends testing, with the local wheel uploaded

>>> [CLI] bundle deploy
Uploading dist/test_helpers-0.1-py3-none-any.whl...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files...
Created pipelines.orders
Files: 6 uploaded, 0 deleted
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> print_requests.py //api/2.0/pipelines --nostamp
{
"method": "POST",
"path": "/api/2.0/pipelines",
"testing": {
"environment": {
"dependencies": [
"-e /Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files[test]",
"-r /Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files/tests/requirements.txt",
"/Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/artifacts/.internal/test_helpers-0.1-py3-none-any.whl"
]
},
"sources": [
{
"glob": {
"include": "/Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files/tests/**"
}
}
]
}
}

=== No changes after the deploy

>>> [CLI] bundle plan
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged

=== A remote edit that drops testing shows in the plan

>>> [CLI] bundle plan -o json
"update"

>>> [CLI] bundle deploy
Uploading dist/test_helpers-0.1-py3-none-any.whl...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files...
Updated pipelines.orders
Files: 1 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> [CLI] bundle plan
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged

=== Changing testing updates the pipeline

>>> update_file.py databricks.yml ./tests/** ./tests/unit/**

>>> [CLI] bundle plan
update pipelines.orders

Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged

>>> [CLI] bundle deploy
Uploading dist/test_helpers-0.1-py3-none-any.whl...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files...
Updated pipelines.orders
Files: 1 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> print_requests.py //api/2.0/pipelines --nostamp
{
"method": "PUT",
"path": "/api/2.0/pipelines/[ORDERS_ID]",
"sources": [
{
"glob": {
"include": "/Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files/tests/unit/**"
}
}
]
}

=== Removing testing sends an update without it

>>> [CLI] bundle plan
update pipelines.orders

Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/pipeline-testing/default/files...
Updated pipelines.orders
Files: 1 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> print_requests.py //api/2.0/pipelines --nostamp
{
"method": "PUT",
"path": "/api/2.0/pipelines/[ORDERS_ID]",
"has_testing": false
}

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

This action will result in the deletion of the following Lakeflow Spark Declarative Pipelines along with the
Streaming Tables (STs) and Materialized Views (MVs) managed by them. Set 'cascade_on_destroy: false' on a pipeline to retain datasets on pipeline deletion:
delete resources.pipelines.orders

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

Destroy: 1 deleted
33 changes: 33 additions & 0 deletions acceptance/bundle/resources/pipelines/testing/script
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
title "Relative test paths resolve to the deployed workspace paths"
trace $CLI bundle validate -o json | jq .resources.pipelines.orders.testing

title "Deploy sends testing, with the local wheel uploaded"
trace $CLI bundle deploy
trace print_requests.py //api/2.0/pipelines --nostamp | jq '{method, path, testing: .body.testing}'

title "No changes after the deploy"
trace $CLI bundle plan

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.

Just to double check: on dogfood, did bundle plan show 0 changes right after deploying a pipeline with testing? The description covers existing pipelines and removing it, but the fake server echoes the body back, so it can't tell us whether the backend normalizes glob.include or the -e /Workspace/...[test] dependency on read.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. Pranshu checked it on a real workspace (see his review on #7300): after a deploy with testing, the next plan showed 0 changes. The fake server cannot show this, as you say.

rm "$OUT_REQUESTS"

title "A remote edit that drops testing shows in the plan"
PIPELINE_ID=$(read_id.py orders)
MSYS_NO_PATHCONV=1 $CLI api get "/api/2.0/pipelines/$PIPELINE_ID" | jq '.spec | del(.testing)' > edit.json
MSYS_NO_PATHCONV=1 $CLI api put "/api/2.0/pipelines/$PIPELINE_ID" --json @edit.json &> LOG.edit
rm edit.json
trace $CLI bundle plan -o json | jq '.plan["resources.pipelines.orders"].changes.testing.action'
trace $CLI bundle deploy
trace $CLI bundle plan
rm "$OUT_REQUESTS"

title "Changing testing updates the pipeline"
trace update_file.py databricks.yml './tests/**' './tests/unit/**'
trace $CLI bundle plan
trace $CLI bundle deploy
trace print_requests.py //api/2.0/pipelines --nostamp | jq '{method, path, sources: .body.testing.sources}'

title "Removing testing sends an update without it"
update_file.py databricks.yml "$(sed -n '/^ testing:/,$p' databricks.yml)" ""
trace $CLI bundle plan
trace $CLI bundle deploy
trace print_requests.py //api/2.0/pipelines --nostamp | jq '{method, path, has_testing: (.body | has("testing"))}'

trace $CLI bundle destroy --auto-approve
rm "$OUT_REQUESTS"
Loading