Skip to content

Commit 7cc4db7

Browse files
shreyas-goenkaIsaac
andcommitted
acc: follow the base's per-command recording switch
The DMS tests now enable recording through the env var per command rather than by editing databricks.yml, so the tests that turn it off had to do the same. failed-delete drains the reads print_state.py makes against the service, which would otherwise be left for the harness to diff. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 2ff2614 commit 7cc4db7

7 files changed

Lines changed: 31 additions & 8 deletions

File tree

acceptance/bundle/dms/existing-state/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
7676
=== So it is accepted even with the deployment gone. The file's state is a no-op while recording, so the service having nothing means the job is created again under a fresh deployment
7777
>>> MSYS_NO_PATHCONV=1 [CLI] workspace delete /Workspace/Users/[USERNAME]/.bundle/dms-existing-state-[UNIQUE_NAME]/default/state/resources.deployment.json
7878

79-
>>> [CLI] bundle deploy
79+
>>> DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=true [CLI] bundle deploy
8080
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-existing-state-[UNIQUE_NAME]/default/files...
8181
Created jobs.one
8282
Files: 2 uploaded, 0 deleted

acceptance/bundle/dms/existing-state/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ trace jq '{state_version, features}' .databricks/bundle/default/resources.json
2626

2727
title "So it is accepted even with the deployment gone. The file's state is a no-op while recording, so the service having nothing means the job is created again under a fresh deployment"
2828
trace MSYS_NO_PATHCONV=1 $CLI workspace delete "/Workspace/Users/${CURRENT_USER_NAME}/.bundle/dms-existing-state-${UNIQUE_NAME}/default/state/resources.deployment.json"
29-
trace $CLI bundle deploy
29+
trace DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=true $CLI bundle deploy
3030
trace print_requests.py --dms //api/2.0/bundle --oneline

acceptance/bundle/dms/failed-delete/output.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,24 @@ API message: Fault injected by test.
126126
"features": {
127127
"record_deployment_history": {}
128128
},
129-
"state": {}
129+
"state": {
130+
"resources.jobs.stuck": {
131+
"__id__": "[NUMID]",
132+
"state": {
133+
"deployment": {
134+
"deployment_id": "[NUMID]",
135+
"kind": "BUNDLE",
136+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete-[UNIQUE_NAME]/default/state/metadata.json",
137+
"version_id": "1"
138+
},
139+
"edit_mode": "UI_LOCKED",
140+
"format": "MULTI_TASK",
141+
"max_concurrent_runs": 1,
142+
"name": "stuck",
143+
"queue": {
144+
"enabled": true
145+
}
146+
}
147+
}
148+
}
130149
}

acceptance/bundle/dms/failed-delete/script

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ trace fault.py "POST /api/2.2/jobs/delete" 400 0 1 INVALID_PARAMETER_VALUE
1010
trace musterr $CLI bundle destroy --auto-approve
1111
trace print_requests.py --dms //api/2.0/bundle
1212
trace print_state.py
13+
14+
# print_state.py asks the service for the resources while recording, so drain those reads instead
15+
# of leaving them behind for the harness to diff.
16+
print_requests.py //api/2.0 > /dev/null

acceptance/bundle/dms/requires-recording/out.test.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/dms/requires-recording/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
1414
=== Turning recording off is refused: the service holds this deployment, so deploying without recording would leave it describing resources that have moved on
1515
>>> update_file.py databricks.yml record_deployment_history: true record_deployment_history: false
1616

17-
>>> musterr [CLI] bundle deploy
17+
>>> DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY= [CLI] bundle deploy
1818
Error: this deployment was previously deployed with experimental.record_deployment_history, so the feature cannot be turned off now
1919

2020
Set it back to true to deploy or destroy this bundle
2121

2222

2323
=== Destroy is refused for the same reason, which is why the error says to put the setting back
24-
>>> musterr [CLI] bundle destroy --auto-approve
24+
>>> DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY= [CLI] bundle destroy --auto-approve
2525
Error: this deployment was previously deployed with experimental.record_deployment_history, so the feature cannot be turned off now
2626

2727
Set it back to true to deploy or destroy this bundle

acceptance/bundle/dms/requires-recording/script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ trace jq '.features' .databricks/bundle/default/resources.json
66

77
title "Turning recording off is refused: the service holds this deployment, so deploying without recording would leave it describing resources that have moved on"
88
trace update_file.py databricks.yml "record_deployment_history: true" "record_deployment_history: false"
9-
trace musterr $CLI bundle deploy
9+
musterr trace DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY= $CLI bundle deploy
1010

1111
title "Destroy is refused for the same reason, which is why the error says to put the setting back"
12-
trace musterr $CLI bundle destroy --auto-approve
12+
musterr trace DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY= $CLI bundle destroy --auto-approve
1313

1414
title "With recording back on, deploy and destroy work again"
1515
trace update_file.py databricks.yml "record_deployment_history: false" "record_deployment_history: true"

0 commit comments

Comments
 (0)