-
Notifications
You must be signed in to change notification settings - Fork 166
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
chore: Upgrades cluster_outage_simulation
resource to auto-generated SDK
#1935
Conversation
internal/service/clusteroutagesimulation/data_source_cluster_outage_simulation_test.go
Outdated
Show resolved
Hide resolved
return fmt.Errorf(errorClusterOutageSimulationSetting, "state", err) | ||
} | ||
if err := d.Set("start_request_date", outageSimulation.StartRequestDate); err != nil { | ||
if err := d.Set("start_request_date", conversion.TimeToString(outageSimulation.GetStartRequestDate())); err != nil { |
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.
if err := d.Set("start_request_date", conversion.TimeToString(outageSimulation.GetStartRequestDate())); err != nil { | |
if err := d.Set("start_request_date", conversion.TimePtrToStringPtr(outageSimulation.StartRequestDate)); err != nil { |
I you look at TimeToString implementation it will fail (or render a weird time) if it's nil, better to work with the pointer function
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.
I think it will panic because UTC doesn't check nil:
// UTC returns t with the location set to UTC.
func (t Time) UTC() Time {
t.setLoc(&utcLoc)
return t
}
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.
Thanks for noticing, changed to use TimePtrToStringPtr
@@ -69,14 +69,14 @@ func TestAccOutageSimulationClusterDS_MultiRegion_basic(t *testing.T) { | |||
func dataSourceConfigSingleRegion(projectName, orgID, clusterName string) string { | |||
return fmt.Sprintf(` | |||
resource "mongodbatlas_project" "outage_project" { | |||
name = "%s" | |||
org_id = "%s" | |||
name = %[1]q |
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.
great!
Description
Upgrades
cluster_outage_simulation
resource to auto-generated SDKAdd migration test
Link to any related issue(s): CLOUDP-226079
Type of change:
Required Checklist:
Further comments