Skip to content

Commit

Permalink
Enable default-python tests on the cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
denik committed Feb 27, 2025
1 parent 682e44b commit 14cd760
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- [TESTROOT]/bundle/templates/default-python/classic-cloud/../classic/output/my_default_python/databricks.yml
+++ output/my_default_python/databricks.yml
@@ -26,4 +26,4 @@
root_path: /Workspace/Users/[USERNAME]/.bundle/${bundle.name}/${bundle.target}
permissions:
- - user_name: [USERNAME]
+ - service_principal_name: [USERNAME]
level: CAN_MANAGE
--- [TESTROOT]/bundle/templates/default-python/classic-cloud/../classic/output/my_default_python/resources/my_default_python.job.yml
+++ output/my_default_python/resources/my_default_python.job.yml
@@ -10,8 +10,4 @@
interval: 1
unit: DAYS
-
- email_notifications:
- on_failure:
- - [USERNAME]

tasks:
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

>>> [CLI] bundle init default-python --config-file [TESTROOT]/bundle/templates/default-python/classic-cloud/../classic/input.json --output-dir output

Welcome to the default Python template for Databricks Asset Bundles!
Workspace to use (auto-detected, edit in 'my_default_python/databricks.yml'): [DATABRICKS_URL]

✨ Your new project has been created in the 'my_default_python' directory!

Please refer to the README.md file for "getting started" instructions.
See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html.

>>> [CLI] bundle validate -t dev
Name: my_default_python
Target: dev
Workspace:
Host: [DATABRICKS_URL]
User: [USERNAME]
Path: /Workspace/Users/[USERNAME]/.bundle/my_default_python/dev

Validation OK!

>>> [CLI] bundle validate -t prod
Name: my_default_python
Target: prod
Workspace:
Host: [DATABRICKS_URL]
User: [USERNAME]
Path: /Workspace/Users/[USERNAME]/.bundle/my_default_python/prod

Validation OK!
15 changes: 15 additions & 0 deletions acceptance/bundle/templates/default-python/classic-cloud/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
trace $CLI bundle init default-python --config-file $TESTDIR/../classic/input.json --output-dir output

cd output/my_default_python
trace $CLI bundle validate -t dev
trace $CLI bundle validate -t prod

# Do not affect this repository's git behaviour #2318
mv .gitignore out.gitignore

cd ../../

# Calculate the difference from the classic template run against fake stub
diff.py $TESTDIR/../classic/output output/ > out.compare-vs-local.diff

rm -fr output
11 changes: 11 additions & 0 deletions acceptance/bundle/templates/default-python/classic-cloud/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Local = false
Cloud = true

[[Repls]]
Old = '\bnode_type_id: [0-9a-zA-Z_.-]+\b'
New = 'node_type_id: (redacted)'

[[Repls]]
# windows fix
Old = '\\'
New = '/'
2 changes: 1 addition & 1 deletion acceptance/bundle/templates/test.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# At the moment, there are many differences across different envs w.r.t to catalog use, node type and so on.
# There are many differences across envs, so there are dedicated tests (suffixed with -cloud) for cloud envs.
Cloud = false
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ resources:
email_notifications:
on_failure:
- {{user_name}}

{{else}}

{{end -}}
{{- end}}

tasks:
{{- if eq .include_notebook "yes" }}
Expand Down

0 comments on commit 14cd760

Please sign in to comment.