Skip to content

Commit a2ed757

Browse files
authored
Add more tests for bind (#4241)
## Changes Add more test for bind: - Two tests for resource that is already managed. One for the same id and another for different. - Pipelines: to be updated and to be recreated. ## Why Capture more cases for direct engine implementation.
1 parent daf34b0 commit a2ed757

35 files changed

+525
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bundle:
2+
name: my_project
3+
4+
resources:
5+
jobs:
6+
foo:
7+
name: My Job
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
>>> musterr [CLI] bundle deployment bind foo [NEW_JOB_ID]
3+
Error: terraform import: exit status 1
4+
5+
Error: Resource already managed by Terraform
6+
7+
Terraform is already managing a remote object for databricks_job.foo. To
8+
import to this address you must first remove the existing object from the
9+
state.
10+
11+
12+

acceptance/bundle/deployment/bind/job/already-managed-different/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
>>> [CLI] bundle deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_project/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
>>> [CLI] jobs create --json {"name": "My Job"}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Bind job that is already bound to another ID
2+
trace $CLI bundle deploy
3+
4+
new_job_id=$(trace $CLI jobs create --json '{"name": "My Job"}' | jq -r '.job_id')
5+
add_repl.py $new_job_id NEW_JOB_ID
6+
7+
trace musterr $CLI bundle deployment bind foo $new_job_id &> out.bind.$DATABRICKS_BUNDLE_ENGINE.txt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cloud = false
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bundle:
2+
name: my_project
3+
4+
resources:
5+
jobs:
6+
foo:
7+
name: My Job
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
>>> musterr [CLI] bundle deployment bind foo [FOO_ID]
3+
Error: terraform import: exit status 1
4+
5+
Error: Resource already managed by Terraform
6+
7+
Terraform is already managing a remote object for databricks_job.foo. To
8+
import to this address you must first remove the existing object from the
9+
state.
10+
11+
12+

acceptance/bundle/deployment/bind/job/already-managed-same/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
>>> [CLI] bundle deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_project/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
>>> [CLI] bundle plan
9+
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged

0 commit comments

Comments
 (0)