Skip to content

Commit 9a9e651

Browse files
authored
acc: split bundle/templates/default-python/combinations in 2 tests (#3140)
There 32 variants, hard to see what's going on where. Splitting by serverless gives better structure Also, replace single-letter var names with slightly longer ones.
1 parent 7ca636b commit 9a9e651

File tree

9 files changed

+72
-17
lines changed

9 files changed

+72
-17
lines changed

acceptance/bundle/templates/default-python/combinations/check_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import os
44
import subprocess
55

6-
SERVERLESS = os.environ["S"] == "yes"
7-
INCLUDE_PYTHON = os.environ["P"] == "yes"
6+
SERVERLESS = os.environ["SERVERLESS"] == "yes"
7+
INCLUDE_PYTHON = os.environ["PY"] == "yes"
88

99
CLOUD_ENV = os.environ.get("CLOUD_ENV")
1010
if CLOUD_ENV and SERVERLESS and not os.environ.get("TEST_METASTORE_ID"):

acceptance/bundle/templates/default-python/combinations/output.txt renamed to acceptance/bundle/templates/default-python/combinations/classic/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Workspace:
3131

3232
Validation OK!
3333

34-
>>> ../check_output.py [CLI] bundle deploy -t dev
34+
>>> [TESTROOT]/bundle/templates/default-python/combinations/classic/../check_output.py [CLI] bundle deploy -t dev
3535
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/X[UNIQUE_NAME]/dev/files...
3636
Deploying resources...
3737
Deployment complete!

acceptance/bundle/templates/default-python/combinations/script renamed to acceptance/bundle/templates/default-python/combinations/classic/script

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
envsubst < input.json.tmpl > input.json
1+
envsubst < $TESTDIR/../input.json.tmpl > input.json
22
trace $CLI bundle init default-python --config-file ./input.json
33

44
cd ./X*
55
trace yamlcheck.py
66
trace $CLI bundle validate -t dev
77
trace $CLI bundle validate -t prod
88

9-
trace ../check_output.py $CLI bundle deploy -t dev
9+
trace $TESTDIR/../check_output.py $CLI bundle deploy -t dev
1010

1111
# Fails on testserver with: Error: Method Not Allowed
1212
#trace ../check_output.py $CLI bundle deploy -t prod
1313

14-
# Do not affect this repository's git behaviour #2318
15-
mv .gitignore out.gitignore
16-
rm .databricks/.gitignore
1714
cd ..
1815
rm -fr X*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Env.SERVERLESS = "no"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"project_name": "X$UNIQUE_NAME",
3-
"include_notebook": "$N",
4-
"include_dlt": "$D",
5-
"include_python": "$P",
6-
"serverless": "$S"
3+
"include_notebook": "$NBOOK",
4+
"include_dlt": "$DLT",
5+
"include_python": "$PY",
6+
"serverless": "$SERVERLESS"
77
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
>>> [CLI] bundle init default-python --config-file ./input.json
3+
4+
Welcome to the default Python template for Databricks Asset Bundles!
5+
Workspace to use (auto-detected, edit in 'X[UNIQUE_NAME]/databricks.yml'): [DATABRICKS_URL]
6+
7+
✨ Your new project has been created in the 'X[UNIQUE_NAME]' directory!
8+
9+
Please refer to the README.md file for "getting started" instructions.
10+
See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html.
11+
12+
>>> yamlcheck.py
13+
14+
>>> [CLI] bundle validate -t dev
15+
Name: X[UNIQUE_NAME]
16+
Target: dev
17+
Workspace:
18+
Host: [DATABRICKS_URL]
19+
User: [USERNAME]
20+
Path: /Workspace/Users/[USERNAME]/.bundle/X[UNIQUE_NAME]/dev
21+
22+
Validation OK!
23+
24+
>>> [CLI] bundle validate -t prod
25+
Name: X[UNIQUE_NAME]
26+
Target: prod
27+
Workspace:
28+
Host: [DATABRICKS_URL]
29+
User: [USERNAME]
30+
Path: /Workspace/Users/[USERNAME]/.bundle/X[UNIQUE_NAME]/prod
31+
32+
Validation OK!
33+
34+
>>> [TESTROOT]/bundle/templates/default-python/combinations/serverless/../check_output.py [CLI] bundle deploy -t dev
35+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/X[UNIQUE_NAME]/dev/files...
36+
Deploying resources...
37+
Deployment complete!
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
envsubst < $TESTDIR/../input.json.tmpl > input.json
2+
trace $CLI bundle init default-python --config-file ./input.json
3+
4+
cd ./X*
5+
trace yamlcheck.py
6+
trace $CLI bundle validate -t dev
7+
trace $CLI bundle validate -t prod
8+
9+
trace $TESTDIR/../check_output.py $CLI bundle deploy -t dev
10+
11+
# Fails on testserver with: Error: Method Not Allowed
12+
#trace ../check_output.py $CLI bundle deploy -t prod
13+
14+
cd ..
15+
rm -fr X*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Env.SERVERLESS = "yes"

acceptance/bundle/templates/default-python/combinations/test.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ Ignore = ["input.json"]
44

55
# Using shortcuts, because max path component name on Windows is 256 chars
66
# INCLUDE_NOTEBOOK
7-
EnvMatrix.N = ["yes", "no"]
7+
EnvMatrix.NBOOK = ["yes", "no"]
88

99
# INCLUDE_DLT
10-
EnvMatrix.D = ["yes", "no"]
10+
EnvMatrix.DLT = ["yes", "no"]
1111

1212
# INCLUDE_PYTHON
13-
EnvMatrix.P = ["yes", "no"]
13+
EnvMatrix.PY = ["yes", "no"]
1414

15-
# SERVERLESS
16-
EnvMatrix.S = ["yes", "no"]
15+
# SERVERLESS -- configured in subtest
16+
#EnvMatrix.S = ["yes", "no"]
1717

1818
[[Repls]]
1919
Old = '202\d{5}.\d{5,}'
2020
New = '[VERSION_TIMESTAMP]'
21+
22+
[[Repls]]
23+
Old = '\\'
24+
New = '/'

0 commit comments

Comments
 (0)