Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hemeryar committed Nov 14, 2024
1 parent a4391ea commit 01d04c3
Show file tree
Hide file tree
Showing 6 changed files with 462 additions and 74 deletions.
13 changes: 7 additions & 6 deletions datadog/fwprovider/resource_datadog_rum_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ func (r *rumMetricResource) Schema(_ context.Context, _ resource.SchemaRequest,
"path": schema.StringAttribute{
Description: "The path to the value the rum-based metric will aggregate on. Only present when `aggregation_type` is `distribution`.",
Optional: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
},
},
},
Expand Down Expand Up @@ -212,7 +215,7 @@ func (r *rumMetricResource) Update(ctx context.Context, request resource.UpdateR
return
}

id := state.ID.ValueString()
id := state.Name.ValueString()

body, diags := r.buildRumMetricUpdateRequestBody(ctx, &state)
response.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -273,9 +276,7 @@ func (r *rumMetricResource) updateState(ctx context.Context, state *rumMetricMod
computeTf.IncludePercentiles = types.BoolValue(*includePercentiles)
}
if path, ok := compute.GetPathOk(); ok {
if *path != "" {
computeTf.Path = types.StringValue(*path)
}
computeTf.Path = types.StringValue(*path)
}

state.Compute = &computeTf
Expand Down Expand Up @@ -366,7 +367,7 @@ func (r *rumMetricResource) buildRumMetricRequestBody(ctx context.Context, state

req := datadogV2.NewRumMetricCreateRequestWithDefaults()
req.Data = *datadogV2.NewRumMetricCreateDataWithDefaults()
req.Data.SetId(state.Name.String())
req.Data.SetId(state.Name.ValueString())
req.Data.SetAttributes(*attributes)

return req, diags
Expand Down Expand Up @@ -410,7 +411,7 @@ func (r *rumMetricResource) buildRumMetricUpdateRequestBody(ctx context.Context,

req := datadogV2.NewRumMetricUpdateRequestWithDefaults()
req.Data = *datadogV2.NewRumMetricUpdateDataWithDefaults()
req.Data.SetId(state.Name.String())
req.Data.SetId(state.Name.ValueString())
req.Data.SetAttributes(*attributes)

return req, diags
Expand Down
2 changes: 1 addition & 1 deletion datadog/tests/cassettes/TestAccRumMetricAttributes.freeze
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-11-13T14:53:37.123281+01:00
2024-11-14T08:43:39.339296+01:00
Loading

0 comments on commit 01d04c3

Please sign in to comment.