-
Notifications
You must be signed in to change notification settings - Fork 181
Reproduce stale-published-content dashboard bug as acceptance test #5597
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
16fbaf8
Reproduce stale-published-content bug as acceptance test
denik 2fa12b9
dashboard tests: replace generic ETAG regex with specific add_repl.py…
denik 4e0e059
clean up[
denik 11e7712
testserver: bump dashboard etag on every PATCH, matching cloud behavior
denik c45317e
acceptance: fix comments and show stale content after failed re-deploy
denik 5907889
acceptance: use explicit ETAG_1/ETAG_2 labels in publish-failure-stal…
denik d3e942b
acceptance: use explicit ETAG_1/ETAG_2 labels in detect-change
denik 9c50bd0
acceptance: show that --force recovers from stale-content state
denik 74eb86b
acceptance: record JSON plans after first and second deploys
denik f27d76f
acceptance: inline plans via gron.py | grep etag|published
denik d0c4fc6
acceptance: move print_requests after each deploy; add final plan check
denik 554c55d
dresources: fix TestAll to handle server-generated field changes afte…
denik 39aa4fc
acceptance: fix Windows path issue in dashboard tests
denik 0133f23
acceptance: document stale-content bug in Badness field
denik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| "etag": { | ||
| "action": "update", | ||
| "reason": "custom", | ||
| "old": [ETAG] | ||
| "old": "[ETAG]" | ||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
acceptance/bundle/resources/dashboards/publish-failure-stale-content/dashboard.lvdash.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"pages":[{"name":"test-page","displayName":"Test Dashboard"}]} |
9 changes: 9 additions & 0 deletions
9
acceptance/bundle/resources/dashboards/publish-failure-stale-content/databricks.yml.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| bundle: | ||
| name: update-publish-failure-stale-content | ||
|
|
||
| resources: | ||
| dashboards: | ||
| dashboard1: | ||
| display_name: my dashboard | ||
| warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID | ||
| file_path: ./dashboard.lvdash.json |
4 changes: 4 additions & 0 deletions
4
acceptance/bundle/resources/dashboards/publish-failure-stale-content/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
172 changes: 172 additions & 0 deletions
172
acceptance/bundle/resources/dashboards/publish-failure-stale-content/output.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-publish-failure-stale-content/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] lakeview get [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard", | ||
| "etag": "[ETAG_1]" | ||
| } | ||
|
|
||
| >>> [CLI] lakeview get-published [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard" | ||
| } | ||
|
|
||
| >>> [CLI] bundle plan -o json | ||
| json.plan.resources.dashboards.dashboard1.remote_state.etag = "[ETAG_1]"; | ||
| json.plan.resources.dashboards.dashboard1.remote_state.published = true; | ||
| json.plan.resources.dashboards.dashboard1.changes.etag.action = "skip"; | ||
| json.plan.resources.dashboards.dashboard1.changes.etag.reason = "custom"; | ||
| json.plan.resources.dashboards.dashboard1.changes.etag.old = "[ETAG_1]"; | ||
| json.plan.resources.dashboards.dashboard1.changes.etag.remote = "[ETAG_1]"; | ||
| json.plan.resources.dashboards.dashboard1.changes.serialized_dashboard.reason = "etag_based"; | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-publish-failure-stale-content/default/files... | ||
| Deploying resources... | ||
| Error: cannot update resources.dashboards.dashboard1: updating id=[DASHBOARD1_ID]: Fault injected by test. (400 INJECTED) | ||
|
|
||
| Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]/published | ||
| HTTP Status: 400 Bad Request | ||
| API error_code: INJECTED | ||
| API message: Fault injected by test. | ||
|
|
||
| Updating deployment state... | ||
|
|
||
| Exit code: 1 | ||
|
|
||
| >>> print_requests.py //lakeview/dashboards | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]", | ||
| "body": { | ||
| "display_name": "my dashboard renamed", | ||
| "parent_path": "/Workspace/Users/[USERNAME]/.bundle/update-publish-failure-stale-content/default/resources", | ||
| "serialized_dashboard": "{\"pages\":[{\"name\":\"test-page\",\"displayName\":\"Test Dashboard\"}]}\n", | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| } | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]/published", | ||
| "body": { | ||
| "embed_credentials": false, | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| } | ||
| } | ||
|
|
||
| >>> [CLI] lakeview get [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard renamed", | ||
| "etag": "[ETAG_2]" | ||
| } | ||
|
|
||
| >>> [CLI] lakeview get-published [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard" | ||
| } | ||
|
|
||
| >>> [CLI] bundle plan -o json | ||
| Warning: dashboard "dashboard1" has been modified remotely | ||
| at resources.dashboards.dashboard1 | ||
| in databricks.yml:7:7 | ||
|
|
||
| This dashboard has been modified remotely since the last bundle deployment. | ||
| These modifications are untracked and will be overwritten on deploy. | ||
|
|
||
| Make sure that the local dashboard definition matches what you intend to deploy | ||
| before proceeding with the deployment. | ||
|
|
||
| To overwrite the remote changes with your local version, use --force. | ||
| The remote modifications will be lost. | ||
|
|
||
| json.plan.resources.dashboards.dashboard1.new_state.value.published = true; | ||
| json.plan.resources.dashboards.dashboard1.remote_state.etag = "[ETAG_2]"; | ||
| json.plan.resources.dashboards.dashboard1.remote_state.published = true; | ||
| json.plan.resources.dashboards.dashboard1.changes.etag.action = "update"; | ||
| json.plan.resources.dashboards.dashboard1.changes.etag.old = "[ETAG_1]"; | ||
| json.plan.resources.dashboards.dashboard1.changes.etag.remote = "[ETAG_2]"; | ||
| json.plan.resources.dashboards.dashboard1.changes.serialized_dashboard.reason = "etag_based"; | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Error: dashboard "dashboard1" has been modified remotely | ||
| at resources.dashboards.dashboard1 | ||
| in databricks.yml:7:7 | ||
|
|
||
| This dashboard has been modified remotely since the last bundle deployment. | ||
| These modifications are untracked and will be overwritten on deploy. | ||
|
|
||
| Make sure that the local dashboard definition matches what you intend to deploy | ||
| before proceeding with the deployment. | ||
|
|
||
| To overwrite the remote changes with your local version, use --force. | ||
| The remote modifications will be lost. | ||
|
|
||
|
|
||
| Exit code: 1 | ||
|
|
||
| >>> print_requests.py //lakeview/dashboards | ||
|
|
||
| >>> [CLI] lakeview get [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard renamed", | ||
| "etag": "[ETAG_2]" | ||
| } | ||
|
|
||
| >>> [CLI] lakeview get-published [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard" | ||
| } | ||
|
|
||
| >>> [CLI] bundle deploy --force | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-publish-failure-stale-content/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> print_requests.py //lakeview/dashboards | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]", | ||
| "body": { | ||
| "display_name": "my dashboard renamed", | ||
| "parent_path": "/Workspace/Users/[USERNAME]/.bundle/update-publish-failure-stale-content/default/resources", | ||
| "serialized_dashboard": "{\"pages\":[{\"name\":\"test-page\",\"displayName\":\"Test Dashboard\"}]}\n", | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| } | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/lakeview/dashboards/[DASHBOARD1_ID]/published", | ||
| "body": { | ||
| "embed_credentials": false, | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| } | ||
| } | ||
|
|
||
| >>> [CLI] lakeview get [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard renamed", | ||
| "etag": "[ETAG_3]" | ||
| } | ||
|
|
||
| >>> [CLI] lakeview get-published [DASHBOARD1_ID] | ||
| { | ||
| "display_name": "my dashboard renamed" | ||
| } | ||
|
|
||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.dashboards.dashboard1 | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/update-publish-failure-stale-content/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! |
51 changes: 51 additions & 0 deletions
51
acceptance/bundle/resources/dashboards/publish-failure-stale-content/script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| unset MSYS_NO_PATHCONV | ||
|
|
||
| # First deploy: dashboard is created and published successfully. | ||
| trace $CLI bundle deploy | ||
| replace_ids.py | ||
| DASHBOARD_ID=$($CLI bundle summary --output json | jq -r '.resources.dashboards.dashboard1.id') | ||
| add_repl.py "$($CLI lakeview get $DASHBOARD_ID | jq -r '.etag')" ETAG_1 | ||
| trace $CLI lakeview get $DASHBOARD_ID | jq '{display_name, etag}' | ||
| trace $CLI lakeview get-published $DASHBOARD_ID | jq '{display_name}' | ||
| trace $CLI bundle plan -o json | gron.py | grep -E "etag|published" | ||
| rm out.requests.txt | ||
|
|
||
| # Inject a single publish failure for the update below. | ||
| fault.py "POST /api/2.0/lakeview/dashboards/*" 400 0 1 | ||
|
|
||
| # Rename the dashboard to trigger an Update. | ||
| update_file.py databricks.yml "my dashboard" "my dashboard renamed" | ||
|
|
||
| # Deploy: PATCH succeeds (bumping the remote etag) but publish fails. | ||
| # SaveState is only called on success, so state retains the pre-PATCH etag. | ||
| errcode trace $CLI bundle deploy | ||
| trace print_requests.py //lakeview/dashboards | ||
| add_repl.py "$($CLI lakeview get $DASHBOARD_ID | jq -r '.etag')" ETAG_2 | ||
| trace $CLI lakeview get $DASHBOARD_ID | jq '{display_name, etag}' | ||
| trace $CLI lakeview get-published $DASHBOARD_ID | jq '{display_name}' | ||
| trace $CLI bundle plan -o json | gron.py | grep -E "etag|published" | ||
|
|
||
| # Bug: re-running deploy fails with "modified remotely" because the stored etag | ||
| # (pre-PATCH) no longer matches the remote etag (bumped by the PATCH above). | ||
| # No API writes are attempted — the stale published content is stuck. | ||
| errcode trace $CLI bundle deploy | ||
| trace print_requests.py //lakeview/dashboards | ||
| trace $CLI lakeview get $DASHBOARD_ID | jq '{display_name, etag}' | ||
| trace $CLI lakeview get-published $DASHBOARD_ID | jq '{display_name}' | ||
|
|
||
| # --force bypasses the etag check and forces a full re-deploy (PATCH + POST /published), | ||
| # which fixes the stale published content. | ||
| trace $CLI bundle deploy --force | ||
| trace print_requests.py //lakeview/dashboards | ||
| add_repl.py "$($CLI lakeview get $DASHBOARD_ID | jq -r '.etag')" ETAG_3 | ||
| trace $CLI lakeview get $DASHBOARD_ID | jq '{display_name, etag}' | ||
| trace $CLI lakeview get-published $DASHBOARD_ID | jq '{display_name}' | ||
| trace $CLI bundle plan |
16 changes: 16 additions & 0 deletions
16
acceptance/bundle/resources/dashboards/publish-failure-stale-content/test.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Badness = "after publish failure, re-deploy fails with 'modified remotely' instead of republishing; --force is required as a workaround" | ||
| Cloud = false | ||
| Local = true | ||
| RecordRequests = true | ||
|
|
||
| Ignore = [ | ||
| ".databricks", | ||
| "databricks.yml", | ||
| ] | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct"] | ||
|
|
||
| [[Repls]] | ||
| Old = '\?[ow]=\d+' | ||
| New = "?[WSPARAM]=[NUMID]" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
Badness?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added