Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bundle:
name: change-serialized-inline-$UNIQUE_NAME

resources:
dashboards:
inline_dash:
display_name: Inline Dash
warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID
serialized_dashboard: # inline YAML MAP = the non-string case
pages:
- name: page1
displayName: Page 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"plan_version": 2,
"cli_version": "[CLI_VERSION]",
"lineage": "[UUID]",
"serial": 1,
"plan": {
"resources.dashboards.inline_dash": {
"action": "update",
"new_state": {
"value": {
"display_name": "Inline Dash",
"embed_credentials": false,
"parent_path": "/Workspace/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/resources",
"published": true,
"serialized_dashboard": {
"pages": [
{
"displayName": "Page One",
"name": "page1"
}
]
},
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
},
"remote_state": {
"create_time": "[TIMESTAMP]",
"dashboard_id": "[DASHBOARD_ID]",
"display_name": "Inline Dash",
"embed_credentials": false,
"etag": "[NUMID]",
"lifecycle_state": "ACTIVE",
"parent_path": "/Workspace/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/resources",
"path": "/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/resources/Inline Dash.lvdash.json",
"published": true,
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Page 1\",\"name\":\"page1\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}\n",
"update_time": "[TIMESTAMP]",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
},
"changes": {
"create_time": {
"action": "skip",
"reason": "spec:output_only",
"remote": "[TIMESTAMP]"
},
"dashboard_id": {
"action": "skip",
"reason": "spec:output_only",
"remote": "[DASHBOARD_ID]"
},
"etag": {
"action": "skip",
"reason": "custom",
"old": "[NUMID]",
"remote": "[NUMID]"
},
"lifecycle_state": {
"action": "skip",
"reason": "spec:output_only",
"remote": "ACTIVE"
},
"path": {
"action": "skip",
"reason": "spec:output_only",
"remote": "/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/resources/Inline Dash.lvdash.json"
},
"serialized_dashboard": {
"action": "update",
"old": {
"pages": [
{
"displayName": "Page 1",
"name": "page1"
}
]
},
"new": {
"pages": [
{
"displayName": "Page One",
"name": "page1"
}
]
},
"remote": "{\"pages\":[{\"displayName\":\"Page 1\",\"name\":\"page1\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}\n"
},
"update_time": {
"action": "skip",
"reason": "spec:output_only",
"remote": "[TIMESTAMP]"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cli_version": "[CLI_VERSION]",
"plan": {
"resources.dashboards.inline_dash": {
"action": "update"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"method": "PATCH",
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]",
"body": {
"display_name": "Inline Dash",
"parent_path": "/Workspace/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/resources",
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Page One\",\"name\":\"page1\"}]}",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}
{
"method": "POST",
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published",
"body": {
"embed_credentials": false,
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"method": "PATCH",
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]",
"body": {
"create_time": "[TIMESTAMP]",
"dashboard_id": "[DASHBOARD_ID]",
"display_name": "Inline Dash",
"lifecycle_state": "ACTIVE",
"parent_path": "/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/resources",
"path": "/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/resources/Inline Dash.lvdash.json",
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Page One\",\"name\":\"page1\"}]}",
"update_time": "[TIMESTAMP]",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}
{
"method": "POST",
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published",
"body": {
"embed_credentials": false,
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/files...
Created dashboards.inline_dash
Files: 6 uploaded, 0 deleted
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> [CLI] bundle plan
update dashboards.inline_dash

Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged

>>> [CLI] bundle plan -o json

=== deploy the change
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default/files...
Updated dashboards.inline_dash
Files: 4 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.dashboards.inline_dash

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/change-serialized-inline-[UNIQUE_NAME]/default

Destroy: 1 deleted
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Inherited MSYS_NO_PATHCONV breaks bare python helpers on Windows; this test doesn't need it.
unset MSYS_NO_PATHCONV

cleanup() {
trace $CLI bundle destroy --auto-approve
rm -f out.requests.txt
}
trap cleanup EXIT

# Deploy an inline-YAML-map dashboard.
envsubst < databricks.yml.tmpl > databricks.yml
Comment thread
Sankalp-Mittal marked this conversation as resolved.
trace $CLI bundle deploy
Comment thread
Sankalp-Mittal marked this conversation as resolved.

rm out.requests.txt

dashboard_id=$($CLI bundle summary --output json | jq -r '.resources.dashboards.inline_dash.id')
add_repl "$dashboard_id" DASHBOARD_ID

# Wait out eventual consistency before changing.
retry --until "Page 1" $CLI lakeview get "$dashboard_id" > /dev/null

update_file.py databricks.yml "Page 1" "Page One"

trace $CLI bundle plan | contains.py "update" "!recreate"

trace $CLI bundle plan -o json > out.plan.$DATABRICKS_BUNDLE_ENGINE.json

title "deploy the change\n"
$CLI bundle deploy $(readplanarg out.plan.$DATABRICKS_BUNDLE_ENGINE.json)

print_requests.py //api/2.0/lakeview/dashboards > out.requests.$DATABRICKS_BUNDLE_ENGINE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# the real API returns a pretty printed JSON output which causes
# the test to fail, since we are testing CLI only feature, we can set to
# Cloud = true
Cloud = false

Ignore = [
"databricks.yml",
]

EnvMatrix.READPLAN = ["", "1"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bundle:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something that this test does that change-serialized-inline does not already?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test runs on Cloud=True. This is not done for change-serialized-inline because our testserver and the cloud send json output in different formats (Cloud sends it pretty printed)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, thanks

name: dashboard-serialized-inline-$UNIQUE_NAME

resources:
dashboards:
inline_dash:
display_name: Inline Dash
warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID
serialized_dashboard: # inline YAML MAP = the non-string case
pages:
- name: page1
displayName: Page 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

>>> [CLI] bundle plan
create dashboards.inline_dash

Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dashboard-serialized-inline-[UNIQUE_NAME]/default/files...
Created dashboards.inline_dash
Files: 7 uploaded, 0 deleted
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> print_requests.py //api/2.0/lakeview/dashboards
{
"method": "POST",
"path": "/api/2.0/lakeview/dashboards",
"body": {
"display_name": "Inline Dash",
"parent_path": "/Workspace/Users/[USERNAME]/.bundle/dashboard-serialized-inline-[UNIQUE_NAME]/default/resources",
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Page 1\",\"name\":\"page1\"}]}",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}
{
"method": "POST",
"path": "/api/2.0/lakeview/dashboards/[INLINE_DASH_ID]/published",
"body": {
"embed_credentials": false,
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}
19 changes: 19 additions & 0 deletions acceptance/bundle/resources/dashboards/serialized-inline/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Inherited MSYS_NO_PATHCONV breaks bare python helpers on Windows; this test doesn't need it.
unset MSYS_NO_PATHCONV

envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
# Cleanup; direct's destroy 404s on the stale GET and diverges, so keep it out of the diff.
$CLI bundle destroy --auto-approve &> LOG.destroy
rm -f out.requests.txt
}
trap cleanup EXIT

trace $CLI bundle plan
Comment thread
Sankalp-Mittal marked this conversation as resolved.
$CLI bundle plan -o json > tmp.plan.json
$CLI bundle deploy $(readplanarg tmp.plan.json)
replace_ids.py

# Prove the inline YAML map reaches the API as a JSON string.
trace print_requests.py //api/2.0/lakeview/dashboards
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ignore = [
"databricks.yml",
"tmp.plan.json",
]

EnvMatrix.READPLAN = ["", "1"]
Loading