-
Notifications
You must be signed in to change notification settings - Fork 222
Add acceptance test for inline serialized_dashboard #6463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
384e2d1
b806ba1
aba995f
0e49107
25cd386
2cd3934
9aea125
2d72fb2
722f8eb
b591e5a
2806b22
da5627c
94fc393
88bd169
8766edc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| trace $CLI bundle deploy | ||
|
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: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test runs on Cloud=True. This is not done for
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]" | ||
| } | ||
| } |
| 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 | ||
|
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"] |
Uh oh!
There was an error while loading. Please reload this page.