Skip to content

Commit a6b297a

Browse files
authored
Remove all server mocks from bundle/deploy/dashboard acceptance tests (#3048)
## Why <!-- Why are these changes needed? Provide the context that the reviewer might be missing. For example, were there any decisions behind the change that are not reflected in the code itself? --> This is the last in the series of changes for using testserver instead of mocks in acceptance tests for dashboards deployment ## Related PRs - #3045 - #3047 ## Tests <!-- How have you tested the changes? --> Existing tests <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent 4359e6a commit a6b297a

9 files changed

Lines changed: 30 additions & 81 deletions

File tree

acceptance/bundle/deploy/dashboard/nested-folders/output.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ Deployment complete!
1010
"lifecycle_state": "ACTIVE",
1111
"parent_path": "/Users/[USERNAME]",
1212
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard [UUID].lvdash.json",
13-
"serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}"
13+
"serialized_dashboard": {
14+
"pages": [
15+
{
16+
"name": "02724bf2",
17+
"displayName": "Dashboard test bundle-deploy-dashboard",
18+
"pageType": "PAGE_TYPE_CANVAS"
19+
}
20+
]
21+
}
1422
}
1523

1624
>>> [CLI] bundle destroy --auto-approve

acceptance/bundle/deploy/dashboard/nested-folders/script

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
DASHBOARD_DISPLAY_NAME="test bundle-deploy-dashboard $(uuid)"
22
if [ -z "$CLOUD_ENV" ]; then
3-
DASHBOARD_DISPLAY_NAME="test bundle/deploy/ 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally
43
export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234"
54
fi
65

@@ -15,4 +14,4 @@ trap cleanup EXIT
1514

1615
trace $CLI bundle deploy
1716
DASHBOARD_ID=$($CLI bundle summary --output json | jq -r '.resources.dashboards.dashboard1.id')
18-
trace $CLI lakeview get $DASHBOARD_ID | jq '{lifecycle_state, parent_path, path, serialized_dashboard}'
17+
trace $CLI lakeview get $DASHBOARD_ID | jq '{lifecycle_state, parent_path, path, serialized_dashboard: (.serialized_dashboard | fromjson | {pages: (.pages | map({name, displayName, pageType}))})}'

acceptance/bundle/deploy/dashboard/nested-folders/test.toml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,3 @@ New = "[DASHBOARD_ID]"
1616
# Windows:
1717
Old = 'The system cannot find the file specified.'
1818
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-
'''

acceptance/bundle/deploy/dashboard/simple_outside_bundle_root/output.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ Deployment complete!
1010
"lifecycle_state": "ACTIVE",
1111
"parent_path": "/Users/[USERNAME]",
1212
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard [UUID].lvdash.json",
13-
"serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}"
13+
"serialized_dashboard": {
14+
"pages": [
15+
{
16+
"name": "02724bf2",
17+
"displayName": "Dashboard test bundle-deploy-dashboard",
18+
"pageType": "PAGE_TYPE_CANVAS"
19+
}
20+
]
21+
}
1422
}
1523

1624
>>> [CLI] bundle destroy --auto-approve

acceptance/bundle/deploy/dashboard/simple_outside_bundle_root/script

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
DASHBOARD_DISPLAY_NAME="test bundle-deploy-dashboard $(uuid)"
22
if [ -z "$CLOUD_ENV" ]; then
3-
DASHBOARD_DISPLAY_NAME="test bundle/deploy/ 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally
43
export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234"
54
fi
65
cp $TESTDIR/../simple/sample-dashboard.lvdash.json ../.
@@ -15,4 +14,4 @@ trap cleanup EXIT
1514

1615
trace $CLI bundle deploy
1716
DASHBOARD_ID=$($CLI bundle summary --output json | jq -r '.resources.dashboards.dashboard1.id')
18-
trace $CLI lakeview get $DASHBOARD_ID | jq '{lifecycle_state, parent_path, path, serialized_dashboard}'
17+
trace $CLI lakeview get $DASHBOARD_ID | jq '{lifecycle_state, parent_path, path, serialized_dashboard: (.serialized_dashboard | fromjson | {pages: (.pages | map({name, displayName, pageType}))})}'

acceptance/bundle/deploy/dashboard/simple_outside_bundle_root/test.toml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,3 @@ New = "[DASHBOARD_ID]"
1515
# Windows:
1616
Old = 'The system cannot find the file specified.'
1717
New = 'no such file or directory'
18-
19-
[[Server]]
20-
Pattern = "POST /api/2.0/lakeview/dashboards"
21-
Response.Body = '''
22-
{
23-
"dashboard_id":"1234567890abcdef1234567890abcdef"
24-
}
25-
'''
26-
27-
[[Server]]
28-
Pattern = "POST /api/2.0/lakeview/dashboards/{dashboard_id}/published"
29-
30-
[[Server]]
31-
Pattern = "GET /api/2.0/lakeview/dashboards/{dashboard_id}"
32-
Response.Body = '''
33-
{
34-
"dashboard_id":"1234567890abcdef1234567890abcdef",
35-
"display_name": "test dashboard 6260d50f-e8ff-4905-8f28-812345678903",
36-
"lifecycle_state": "ACTIVE",
37-
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard 6260d50f-e8ff-4905-8f28-812345678903.lvdash.json",
38-
"parent_path": "/Users/tester@databricks.com",
39-
"serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}"
40-
}
41-
'''

acceptance/bundle/deploy/dashboard/simple_syncroot/output.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ Deployment complete!
1010
"lifecycle_state": "ACTIVE",
1111
"parent_path": "/Users/[USERNAME]",
1212
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard [UUID].lvdash.json",
13-
"serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}"
13+
"serialized_dashboard": {
14+
"pages": [
15+
{
16+
"name": "02724bf2",
17+
"displayName": "Dashboard test bundle-deploy-dashboard",
18+
"pageType": "PAGE_TYPE_CANVAS"
19+
}
20+
]
21+
}
1422
}
1523

1624
>>> [CLI] bundle destroy --auto-approve

acceptance/bundle/deploy/dashboard/simple_syncroot/script

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
DASHBOARD_DISPLAY_NAME="test bundle-deploy-dashboard $(uuid)"
22
if [ -z "$CLOUD_ENV" ]; then
3-
DASHBOARD_DISPLAY_NAME="test bundle/deploy/ 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally
43
export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234"
54
fi
65
cp $TESTDIR/../simple/sample-dashboard.lvdash.json .
@@ -16,4 +15,4 @@ trap cleanup EXIT
1615

1716
trace $CLI bundle deploy
1817
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}'
18+
trace $CLI lakeview get $DASHBOARD_ID | jq '{lifecycle_state, parent_path, path, serialized_dashboard: (.serialized_dashboard | fromjson | {pages: (.pages | map({name, displayName, pageType}))})}'

acceptance/bundle/deploy/dashboard/simple_syncroot/test.toml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,3 @@ New = "[DASHBOARD_ID]"
1515
# Windows:
1616
Old = 'The system cannot find the file specified.'
1717
New = 'no such file or directory'
18-
19-
[[Server]]
20-
Pattern = "POST /api/2.0/lakeview/dashboards"
21-
Response.Body = '''
22-
{
23-
"dashboard_id":"1234567890abcdef1234567890abcdef"
24-
}
25-
'''
26-
27-
[[Server]]
28-
Pattern = "POST /api/2.0/lakeview/dashboards/{dashboard_id}/published"
29-
30-
[[Server]]
31-
Pattern = "GET /api/2.0/lakeview/dashboards/{dashboard_id}"
32-
Response.Body = '''
33-
{
34-
"dashboard_id":"1234567890abcdef1234567890abcdef",
35-
"display_name": "test dashboard 6260d50f-e8ff-4905-8f28-812345678903",
36-
"lifecycle_state": "ACTIVE",
37-
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard 6260d50f-e8ff-4905-8f28-812345678903.lvdash.json",
38-
"parent_path": "/Users/tester@databricks.com",
39-
"serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}"
40-
}
41-
'''

0 commit comments

Comments
 (0)