Skip to content
Merged
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
2 changes: 1 addition & 1 deletion acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ func runTest(t *testing.T,
if _, ok := Ignored[relPath]; ok {
continue
}
if config.CompiledIgnoreObject.MatchesPath(relPath) {
if config.CompiledIgnoreObject.MatchesPath(relPath) && !strings.HasPrefix(relPath, "out") {
continue
}
if strings.HasPrefix(filepath.Base(relPath), "LOG") {
Expand Down
2 changes: 1 addition & 1 deletion acceptance/bundle/apps/compute_size/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Local = true
Cloud = true
RecordRequests = false

Ignore = [".databricks", "databricks.yml", "databricks.yml.bak", "out.app-run"]
Ignore = [".databricks", "databricks.yml", "databricks.yml.bak", "tmp.app-run"]

# Apps can take longer to deploy
TimeoutCloud = "5m"
Expand Down
2 changes: 1 addition & 1 deletion acceptance/bundle/apps/git_source/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Deployment complete!
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged

=== Run the app to verify it works
>>> cat out.app-run
>>> cat tmp.app-run
✓ Getting the status of the app [APP_NAME]
✓ App is in RUNNING state
✓ App compute is in ACTIVE state
Expand Down
4 changes: 2 additions & 2 deletions acceptance/bundle/apps/git_source/script
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ title "Verify no drift after deployment"
trace $CLI bundle plan

title "Run the app to verify it works"
$CLI bundle run my_app &> out.app-run || true
trace cat out.app-run | head -20
$CLI bundle run my_app &> tmp.app-run || true
trace cat tmp.app-run | head -20

title "Update git_source branch and redeploy"
# Change branch from main to a different value (still main, but via sed to test config change)
Expand Down
2 changes: 1 addition & 1 deletion acceptance/bundle/apps/git_source/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Cloud = false
RecordRequests = false
RequiresWarehouse = true

Ignore = [".databricks", "databricks.yml", "databricks.yml.bak", "out.app-run"]
Ignore = [".databricks", "databricks.yml", "databricks.yml.bak", "tmp.app-run"]

# Apps can take longer to deploy
TimeoutCloud = "5m"
Expand Down
4 changes: 2 additions & 2 deletions acceptance/bundle/config-remote-sync/output_json/script
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ r["tags"] = {"env": "test"}
EOF

title "JSON output format"
$CLI bundle config-remote-sync -o json > out.json
cat out.json
$CLI bundle config-remote-sync -o json > tmp.json
cat tmp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Cloud = true

RecordRequests = false
Ignore = [".databricks", "dummy.whl", "out.json", "databricks.yml"]
Ignore = [".databricks", "dummy.whl", "tmp.json", "databricks.yml"]

[Env]
DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC = "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ $CLI bundle config-remote-sync | contains.py "No changes detected"

title "JSON output"
echo
$CLI bundle config-remote-sync -o json > out.json
cat out.json
$CLI bundle config-remote-sync -o json > tmp.json
cat tmp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Cloud = true

RecordRequests = false
Ignore = [".databricks", "dummy.whl", "out.json", "databricks.yml"]
Ignore = [".databricks", "dummy.whl", "tmp.json", "databricks.yml"]

[Env]
DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC = "true"
Expand Down
10 changes: 5 additions & 5 deletions acceptance/bundle/deploy/snapshot-comparison/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ Updating deployment state...
Deployment complete!

=== Normalize bundle names for comparison
>>> cp bundle1/.databricks/bundle/default/resources.json out.bundle1.json
>>> cp bundle1/.databricks/bundle/default/resources.json tmp.bundle1.json

>>> cp bundle2/.databricks/bundle/default/resources-config-sync-snapshot.json out.bundle2.json
>>> cp bundle2/.databricks/bundle/default/resources-config-sync-snapshot.json tmp.bundle2.json

>>> update_file.py out.bundle1.json snapshot-test-1- snapshot-test-NORMALIZED-
>>> update_file.py tmp.bundle1.json snapshot-test-1- snapshot-test-NORMALIZED-

>>> update_file.py out.bundle2.json snapshot-test-2- snapshot-test-NORMALIZED-
>>> update_file.py tmp.bundle2.json snapshot-test-2- snapshot-test-NORMALIZED-

=== Compare normalized snapshots
>>> diff.py out.bundle1.json out.bundle2.json
>>> diff.py tmp.bundle1.json tmp.bundle2.json

=== Cleanup bundle 1
>>> [CLI] bundle destroy --auto-approve
Expand Down
12 changes: 7 additions & 5 deletions acceptance/bundle/deploy/snapshot-comparison/script
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ cleanup() {
(cd bundle1 && unset DATABRICKS_BUNDLE_ENGINE && trace $CLI bundle destroy --auto-approve)
title "Cleanup bundle 2"
(cd bundle2 && unset DATABRICKS_BUNDLE_ENGINE && trace $CLI bundle destroy --auto-approve)

rm -f out.requests.txt
}
trap cleanup EXIT

Expand All @@ -30,11 +32,11 @@ title "Deploy bundle 2 with terraform and YamlSync"
(cd bundle2 && trace DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=true DATABRICKS_BUNDLE_ENGINE=terraform $CLI bundle deploy)

title "Normalize bundle names for comparison"
trace cp bundle1/.databricks/bundle/default/resources.json out.bundle1.json
trace cp bundle2/.databricks/bundle/default/resources-config-sync-snapshot.json out.bundle2.json
trace cp bundle1/.databricks/bundle/default/resources.json tmp.bundle1.json
trace cp bundle2/.databricks/bundle/default/resources-config-sync-snapshot.json tmp.bundle2.json

trace update_file.py out.bundle1.json "snapshot-test-1-" "snapshot-test-NORMALIZED-"
trace update_file.py out.bundle2.json "snapshot-test-2-" "snapshot-test-NORMALIZED-"
trace update_file.py tmp.bundle1.json "snapshot-test-1-" "snapshot-test-NORMALIZED-"
trace update_file.py tmp.bundle2.json "snapshot-test-2-" "snapshot-test-NORMALIZED-"

title "Compare normalized snapshots"
trace diff.py out.bundle1.json out.bundle2.json
trace diff.py tmp.bundle1.json tmp.bundle2.json
2 changes: 1 addition & 1 deletion acceptance/bundle/deploy/snapshot-comparison/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RecordRequests = true
Ignore = [
".databricks",
"databricks.yml",
"out.*",
"tmp.*",
"bundle1",
"bundle2"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ cleanup() {

# Also try to delete the old branch directly in case it wasn't cleaned up
$CLI postgres delete-branch "projects/test-pg-proj-${UNIQUE_NAME}/branches/old-branch-${UNIQUE_NAME}" 2>/dev/null || true

rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down Expand Up @@ -51,5 +53,3 @@ print_requests destroy

# Clean up any orphaned old branch (terraform doesn't delete it on recreation)
$CLI postgres delete-branch $branch_id_1 2>/dev/null || true

rm -f out.requests.txt
1 change: 0 additions & 1 deletion acceptance/bundle/resources/postgres_branches/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"]

Ignore = [
"databricks.yml",
"out.requests.txt",
".databricks",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
$CLI bundle destroy --auto-approve > /dev/null 2>&1 || true
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ cleanup() {
# Also try to delete the endpoints directly in case they weren't cleaned up
$CLI postgres delete-endpoint "projects/test-pg-proj-${UNIQUE_NAME}/branches/main/endpoints/test-endpoint-${UNIQUE_NAME}" 2>/dev/null || true
$CLI postgres delete-endpoint "projects/test-pg-proj-${UNIQUE_NAME}/branches/main/endpoints/test-endpoint-${UNIQUE_NAME}-v2" 2>/dev/null || true

rm -f out.requests.txt
}
trap cleanup EXIT

Expand All @@ -15,7 +17,6 @@ envsubst < databricks.yml.tmpl | sed "s/ENDPOINT_ID_PLACEHOLDER/test-endpoint-${
trace cat databricks.yml

trace $CLI bundle plan
rm -f out.requests.txt
trace $CLI bundle deploy

endpoint_id_1=`read_id.py my_endpoint`
Expand Down Expand Up @@ -50,5 +51,3 @@ title "Destroy and verify cleanup"
trace $CLI bundle destroy --auto-approve

trace print_requests

rm -f out.requests.txt
1 change: 0 additions & 1 deletion acceptance/bundle/resources/postgres_endpoints/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"]

Ignore = [
"databricks.yml",
"out.requests.txt",
".databricks",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
$CLI bundle destroy --auto-approve > /dev/null 2>&1 || true
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ cleanup() {

# Also try to delete the old project directly in case it wasn't cleaned up
$CLI postgres delete-project "projects/test-pg-old-${UNIQUE_NAME}" 2>/dev/null || true

rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down Expand Up @@ -51,5 +53,3 @@ print_requests destroy

# Clean up any orphaned old project (terraform doesn't delete it on recreation)
$CLI postgres delete-project $project_id_1 2>/dev/null || true

rm -f out.requests.txt
1 change: 0 additions & 1 deletion acceptance/bundle/resources/postgres_projects/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"]

Ignore = [
"databricks.yml",
"out.requests.txt",
".databricks",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# All configuration inherited from parent test.toml
RecordRequests = false
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

>>> [CLI] bundle init default-python --config-file ./input.json --output-dir output
>>> [CLI] bundle init default-python --config-file ./input.json --output-dir tmp
Welcome to the default Python template for Declarative Automation Bundles!

Answer the following questions to customize your project.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
trace $CLI bundle init default-python --config-file ./input.json --output-dir output
trace $CLI bundle init default-python --config-file ./input.json --output-dir tmp

cd output/fail_missing_uv
cd tmp/fail_missing_uv
trace $CLI bundle validate

# Dynamically find ALL directories containing 'uv' and remove them from PATH
Expand All @@ -11,3 +11,5 @@ done

# Try to deploy, expect failure due to missing uv
errcode trace $CLI bundle deploy

cd ../.. && rm -fr tmp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Badness = "The error message is not ideal: it reports a generic build failure or
Local = true
Cloud = false

Ignore = [
'output/fail_missing_uv',
]

# Replace the uv not found error for portability
[[Repls]]
Old = '(/usr)?(/bin)?/bash(: line 1)?: uv: command not found'
Expand Down
10 changes: 10 additions & 0 deletions acceptance/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ func validateConfig(t *testing.T, config TestConfig, configPath string) {
t.Fatalf("Invalid config %s: RunsOnDbr and RecordRequests cannot both be true. "+
"Serverless does not allow access to localhost ports, which the test proxy server requires.", configPath)
}

// Reject Ignore patterns that target out* files, since those are generated
// output files and must never be ignored.
for _, pattern := range config.Ignore {
name := strings.TrimLeft(pattern, "!/")
if strings.HasPrefix(name, "out") {
t.Fatalf("Invalid config %s: Ignore pattern %q targets output files (out*). "+
"Output files must not be ignored.", configPath, pattern)
}
}
}

func DoLoadConfig(t *testing.T, path string) TestConfig {
Expand Down
2 changes: 2 additions & 0 deletions acceptance/pipelines/e2e/script
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ trace $CLI pipelines destroy --auto-approve

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

rm -fr .databricks
3 changes: 0 additions & 3 deletions acceptance/pipelines/e2e/test.toml
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
Ignore = [
'.databricks',
]
Loading