Skip to content

Commit a0a12cf

Browse files
denikanton-107
andauthored
Add dashboard test with sync outside bundle root (#2997)
Copy of "simple" but with sync section - cannot load the dashboard. --------- Co-authored-by: Anton Nekipelov <226657+anton-107@users.noreply.github.com>
1 parent fb96698 commit a0a12cf

4 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
bundle:
2+
name: deploy-dashboard-test-$UNIQUE_NAME
3+
4+
sync:
5+
paths:
6+
- ..
7+
include:
8+
- ..
9+
10+
resources:
11+
dashboards:
12+
dashboard1:
13+
display_name: $DASHBOARD_DISPLAY_NAME
14+
warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID
15+
embed_credentials: true
16+
file_path: "sample-dashboard.lvdash.json"
17+
parent_path: /Users/$CURRENT_USER_NAME
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
>>> [CLI] bundle deploy
3+
Error: failed to read serialized dashboard from file_path sample-dashboard.lvdash.json: open sample-dashboard.lvdash.json: no such file or directory
4+
5+
6+
>>> [CLI] bundle destroy --auto-approve
7+
Error: failed to read serialized dashboard from file_path sample-dashboard.lvdash.json: open sample-dashboard.lvdash.json: no such file or directory
8+
9+
Exit code: 1
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
DASHBOARD_DISPLAY_NAME="test bundle-deploy-dashboard $(uuid)"
2+
if [ -z "$CLOUD_ENV" ]; then
3+
DASHBOARD_DISPLAY_NAME="test bundle/deploy/ 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally
4+
export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234"
5+
fi
6+
cp $TESTDIR/../simple/sample-dashboard.lvdash.json .
7+
8+
export DASHBOARD_DISPLAY_NAME
9+
envsubst < databricks.yml.tmpl > databricks.yml
10+
11+
cleanup() {
12+
trace $CLI bundle destroy --auto-approve
13+
rm sample-dashboard.lvdash.json
14+
}
15+
trap cleanup EXIT
16+
17+
trace $CLI bundle deploy
18+
DASHBOARD_ID=$($CLI bundle summary --output json | jq -r '.resources.dashboards.dashboard1.id')
19+
trace $CLI lakeview get $DASHBOARD_ID | jq '{lifecycle_state, parent_path, path, serialized_dashboard}'
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Badness = "Cannot read dashboard, expecting deployment to succeed"
2+
Local = true
3+
Cloud = true
4+
RequiresWarehouse = true
5+
6+
Ignore = [
7+
"databricks.yml",
8+
"sample-dashboard.lvdash.json",
9+
]
10+
11+
[[Repls]]
12+
Old = "[0-9a-f]{32}"
13+
New = "[DASHBOARD_ID]"
14+
15+
[[Repls]]
16+
# Windows:
17+
Old = 'The system cannot find the file specified.'
18+
New = 'no such file or directory'
19+
20+
[[Server]]
21+
Pattern = "POST /api/2.0/lakeview/dashboards"
22+
Response.Body = '''
23+
{
24+
"dashboard_id":"1234567890abcdef1234567890abcdef"
25+
}
26+
'''
27+
28+
[[Server]]
29+
Pattern = "POST /api/2.0/lakeview/dashboards/{dashboard_id}/published"
30+
31+
[[Server]]
32+
Pattern = "GET /api/2.0/lakeview/dashboards/{dashboard_id}"
33+
Response.Body = '''
34+
{
35+
"dashboard_id":"1234567890abcdef1234567890abcdef",
36+
"display_name": "test dashboard 6260d50f-e8ff-4905-8f28-812345678903",
37+
"lifecycle_state": "ACTIVE",
38+
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard 6260d50f-e8ff-4905-8f28-812345678903.lvdash.json",
39+
"parent_path": "/Users/tester@databricks.com",
40+
"serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}"
41+
}
42+
'''
43+
44+
[[Server]]
45+
Pattern = "DELETE /api/2.0/lakeview/dashboards/{dashboard_id}"

0 commit comments

Comments
 (0)