Skip to content

Commit a84bac2

Browse files
committed
acc: Replace failing TestGenerateFromExistingPipelineAndDeploy with an acceptance test
1 parent fec675f commit a84bac2

8 files changed

Lines changed: 95 additions & 139 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: pipeline_and_deploy
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Databricks notebook source
2+
print('Hello world!')

acceptance/bundle/generate/pipeline_and_deploy/out.test.toml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
=== Upload files to workspace
3+
>>> [CLI] workspace import /Workspace/Users/[USERNAME]/notebook.py --file notebook.py --format AUTO --overwrite
4+
5+
>>> [CLI] workspace import /Workspace/Users/[USERNAME]/test.py --file test.py --format AUTO --overwrite
6+
7+
=== Create a pipeline that references the filesCreated pipeline
8+
9+
=== Generate bundle config from the pipelineFile successfully saved to src/notebook.py
10+
File successfully saved to src/test.py
11+
Pipeline configuration successfully saved to resources/out.pipeline.yml
12+
13+
=== Verify generated yaml has expected fields
14+
=== Deploy the generated bundle
15+
>>> [CLI] bundle deploy
16+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/pipeline_and_deploy/default/files...
17+
Deploying resources...
18+
Deployment complete!
19+
20+
=== Destroy the deployed bundle
21+
>>> [CLI] bundle destroy --auto-approve
22+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/pipeline_and_deploy/default
23+
24+
Deleting files...
25+
Destroy complete!
26+
27+
=== Cleanup: delete the original pipeline and files
28+
>>> errcode [CLI] pipelines delete [PIPELINE_ID]
29+
30+
>>> errcode [CLI] workspace delete /Workspace/Users/[USERNAME]/notebook
31+
32+
>>> errcode [CLI] workspace delete /Workspace/Users/[USERNAME]/test.py
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
title "Upload files to workspace"
2+
trace $CLI workspace import "/Workspace/Users/${CURRENT_USER_NAME}/notebook.py" --file notebook.py --format AUTO --overwrite
3+
trace $CLI workspace import "/Workspace/Users/${CURRENT_USER_NAME}/test.py" --file test.py --format AUTO --overwrite
4+
5+
title "Create a pipeline that references the files"
6+
PIPELINE_ID=$($CLI pipelines create --json '{
7+
"name": "test-pipeline",
8+
"libraries": [
9+
{
10+
"notebook": {
11+
"path": "/Workspace/Users/'${CURRENT_USER_NAME}'/notebook"
12+
}
13+
},
14+
{
15+
"file": {
16+
"path": "/Workspace/Users/'${CURRENT_USER_NAME}'/test.py"
17+
}
18+
}
19+
]
20+
}' | jq -r '.pipeline_id')
21+
echo "Created pipeline"
22+
add_repl.py "$PIPELINE_ID" PIPELINE_ID
23+
24+
cleanup() {
25+
title "Cleanup: delete the original pipeline and files"
26+
trace errcode $CLI pipelines delete "$PIPELINE_ID"
27+
trace errcode $CLI workspace delete "/Workspace/Users/${CURRENT_USER_NAME}/notebook"
28+
trace errcode $CLI workspace delete "/Workspace/Users/${CURRENT_USER_NAME}/test.py"
29+
}
30+
trap cleanup EXIT
31+
32+
title "Generate bundle config from the pipeline"
33+
$CLI bundle generate pipeline --existing-pipeline-id "$PIPELINE_ID" --key out --config-dir resources --source-dir src --force 2>&1 | sort
34+
35+
title "Verify generated yaml has expected fields"
36+
cat resources/out.pipeline.yml | contains.py "libraries:" "- notebook:" "path: ../src/notebook.py" "- file:" "path: ../src/test.py" > /dev/null
37+
38+
title "Deploy the generated bundle"
39+
trace $CLI bundle deploy
40+
41+
title "Destroy the deployed bundle"
42+
trace $CLI bundle destroy --auto-approve
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print('Hello!')
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Local = true
2+
Cloud = true
3+
4+
Ignore = [
5+
"databricks.yml",
6+
"resources/*",
7+
"src/*",
8+
".databricks",
9+
]
10+
11+
[Env]
12+
# MSYS2 automatically converts absolute paths on Windows; disable for the workspace path.
13+
MSYS_NO_PATHCONV = "1"

integration/bundle/generate_pipeline_test.go

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)