Skip to content

Commit 51392cd

Browse files
committed
acceptance/dashboards: use replace_ids.py and inline plan output in publish-failure-retry
- Replace fixed hex regex [[Repls]] with replace_ids.py called after the first deploy; the real dashboard ID is captured from state as [DASHBOARD1_ID]. - Inline the plan -o json | jq output directly into output.txt instead of saving to out.plan_published_change.json and trace cat-ing it. Co-authored-by: Denis Bilenko
1 parent bf602f1 commit 51392cd

4 files changed

Lines changed: 8 additions & 19 deletions

File tree

acceptance/bundle/resources/dashboards/publish-failure-retry/out.plan_published_change.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

acceptance/bundle/resources/dashboards/publish-failure-retry/output.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/publish-failure-re
44
Deploying resources...
55
Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (400 INJECTED)
66

7-
Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
7+
Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]/published
88
HTTP Status: 400 Bad Request
99
API error_code: INJECTED
1010
API message: Fault injected by test.
@@ -23,11 +23,9 @@ Resources:
2323
Dashboards:
2424
dashboard1:
2525
Name: my dashboard
26-
URL: [DATABRICKS_URL]/dashboardsv3/[DASHBOARD_ID]/published?[WSPARAM]=[NUMID]
26+
URL: [DATABRICKS_URL]/dashboardsv3/[DASHBOARD1_ID]/published?[WSPARAM]=[NUMID]
2727

2828
>>> [CLI] bundle plan -o json
29-
30-
>>> cat out.plan_published_change.json
3129
{
3230
"action": "update",
3331
"old": false,
@@ -42,7 +40,7 @@ Updating deployment state...
4240
Deployment complete!
4341
{
4442
"method": "PATCH",
45-
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]",
43+
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]",
4644
"body": {
4745
"display_name": "my dashboard",
4846
"parent_path": "/Workspace/Users/[USERNAME]/.bundle/publish-failure-retry/default/resources",
@@ -52,7 +50,7 @@ Deployment complete!
5250
}
5351
{
5452
"method": "POST",
55-
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published",
53+
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]/published",
5654
"body": {
5755
"embed_credentials": false,
5856
"warehouse_id": "someid"

acceptance/bundle/resources/dashboards/publish-failure-retry/script

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ fault.py "POST /api/2.0/lakeview/dashboards/*" 400 0 1
1717
# First deploy: dashboard is created and saved to state, but publish fails.
1818
errcode trace $CLI bundle deploy
1919

20+
# Capture the dashboard ID from state so subsequent output is normalized.
21+
replace_ids.py
22+
2023
# Dashboard should be in state (tracked) despite the publish failure.
2124
trace $CLI bundle summary
2225

2326
# Plan should show published: false (saved state) -> true (desired).
24-
# Capture the Changes entry for 'published' to verify the diff direction.
25-
trace $CLI bundle plan -o json | jq '.plan["resources.dashboards.dashboard1"].changes.published' > out.plan_published_change.json
26-
trace cat out.plan_published_change.json
27+
trace $CLI bundle plan -o json | jq '.plan["resources.dashboards.dashboard1"].changes.published'
2728

2829
# Discard first-deploy requests so the output only contains second-deploy
2930
# calls, making it easy to confirm no CREATE was issued.

acceptance/bundle/resources/dashboards/publish-failure-retry/test.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ RecordRequests = true
77
[EnvMatrix]
88
DATABRICKS_BUNDLE_ENGINE = ["direct"]
99

10-
[[Repls]]
11-
Old = "[0-9a-f]{32}"
12-
New = "[DASHBOARD_ID]"
13-
1410
# Dashboard published URLs use ?o= (local testserver) or ?w= (cloud) for the workspace/org ID.
1511
[[Repls]]
1612
Old = '\?[ow]=\d+'

0 commit comments

Comments
 (0)