-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Changes from all commits
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 |
---|---|---|
|
@@ -117,6 +117,15 @@ func TestAccMonitoringDashboard_update(t *testing.T) { | |
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"project"}, | ||
}, | ||
{ | ||
Config: testAccMonitoringDashboard_gridLayoutUpdate(), | ||
}, | ||
{ | ||
ResourceName: "google_monitoring_dashboard.dashboard", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"project"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
@@ -242,6 +251,52 @@ EOF | |
`) | ||
} | ||
|
||
func testAccMonitoringDashboard_gridLayoutUpdate() string { | ||
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. 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! 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. Actually, it appears there is already 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 triggers the index out of range crash. With the fix in this PR, this test passed. 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. Yeah, the comment will help. |
||
return fmt.Sprintf(` | ||
resource "google_monitoring_dashboard" "dashboard" { | ||
dashboard_json = <<EOF | ||
{ | ||
"displayName": "Grid Layout Example", | ||
"gridLayout": { | ||
"columns": "2", | ||
"widgets": [ | ||
{ | ||
"title": "Widget 1", | ||
"xyChart": { | ||
"dataSets": [{ | ||
"timeSeriesQuery": { | ||
"timeSeriesFilter": { | ||
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"", | ||
"aggregation": { | ||
"perSeriesAligner": "ALIGN_RATE" | ||
} | ||
}, | ||
"unitOverride": "1" | ||
}, | ||
"plotType": "LINE" | ||
}], | ||
"timeshiftDuration": "0s", | ||
"yAxis": { | ||
"label": "y1Axis", | ||
"scale": "LINEAR" | ||
} | ||
} | ||
}, | ||
{ | ||
"text": { | ||
"content": "Widget 2", | ||
"format": "MARKDOWN" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
EOF | ||
} | ||
`) | ||
} | ||
|
||
func testAccMonitoringDashboard_rowLayout() string { | ||
return fmt.Sprintf(` | ||
resource "google_monitoring_dashboard" "dashboard" { | ||
|
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.
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?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.
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.