Skip to content
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

Fix the out of boundary error #9628

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Fix the out of boundary error #9628

merged 1 commit into from
Dec 13, 2023

Conversation

zli82016
Copy link
Member

@zli82016 zli82016 commented Dec 12, 2023

fixes hashicorp/terraform-provider-google#16439

Release Note Template for Downstream PRs (will be copied)

monitoring: fixed the index out of range crash when removing metrics from `dashboard_json` for the resource `google_monitoring_dashboard`

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 2 files changed, 56 insertions(+), 1 deletion(-))
Terraform Beta: Diff ( 2 files changed, 56 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3292
Passed tests 2953
Skipped tests: 338
Affected tests: 1

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccMonitoringDashboard_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccMonitoringDashboard_update[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@zli82016 zli82016 requested a review from c2thorn December 12, 2023 22:31
Copy link
Member

@c2thorn c2thorn left a comment

Choose a reason for hiding this comment

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

small suggestion for release note:
error -> crash ?
Also thanks for adding the test scenario!

@etruong42
Copy link
Member

The release note says fixed the index out of range crash in dashboard_json perma-diffs - what does "perma-diff" mean in this context? Perma-diff was a symptom of a bug. Is there a "perma-diff" function here that had an index out of range?

@@ -242,6 +251,52 @@ EOF
`)
}

func testAccMonitoringDashboard_gridLayoutUpdate() string {
Copy link
Member

Choose a reason for hiding this comment

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

Does the addition of this test mean that updating the grid layout is sufficient to trigger the index out of range crash?

If so, thank you for adding this to prevent a future regression!

Copy link
Member

Choose a reason for hiding this comment

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

Actually, it appears there is already testAccMonitoringDashboard_gridLayout - maybe this deserves a comment as to how this is different? Fwiw, I can't tell from the name how the intention behind testAccMonitoringDashboard_gridLayoutUpdate is supposed to be different from testAccMonitoringDashboard_gridLayout

Copy link
Member Author

Choose a reason for hiding this comment

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

This test triggers the index out of range crash. With the fix in this PR, this test passed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the comment will help.

ResourceName: "google_monitoring_dashboard.dashboard",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"project"},
Copy link
Member

Choose a reason for hiding this comment

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

What do each of these fields e.g. ImportState do? I read what appears to be the relevant document at https://googlecloudplatform.github.io/magic-modules/develop/test/ - perhaps I am missing something?

Copy link
Member Author

Choose a reason for hiding this comment

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

These fields are used to test if importing the resource works or not.

ImportState triggers the import testing mode. ImportStateVerify will compare the state after import with the server side response. ImportStateVerifyIgnore will not compare the ignored fields.

@zli82016
Copy link
Member Author

The release note says fixed the index out of range crash in dashboard_json perma-diffs - what does "perma-diff" mean in this context? Perma-diff was a symptom of a bug. Is there a "perma-diff" function here that had an index out of range?

"perma-diff" function here means the DiffSuppressFunc

I modified the release note to make it more clear.

kapreus pushed a commit to kapreus/magic-modules that referenced this pull request Jan 2, 2024
balanaguharsha pushed a commit to balanaguharsha/magic-modules that referenced this pull request May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

monitoring/resource_monitoring_dashboard.go:37 -> "panic: runtime error: index out of range [x] with length x"
5 participants