Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgajard committed May 10, 2024
1 parent 5daccd7 commit 4099cdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
20 changes: 0 additions & 20 deletions pagerdutyplugin/resource_pagerduty_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ func (r *resourceService) Schema(ctx context.Context, req resource.SchemaRequest
},
},
PlanModifiers: []planmodifier.List{
listplanmodifier.RequiresReplace(),
listplanmodifier.UseStateForUnknown(),
planmodify.UseNullForRemovedWithState(),
},
Expand All @@ -252,7 +251,6 @@ func (r *resourceService) Schema(ctx context.Context, req resource.SchemaRequest
listvalidator.SizeBetween(1, 1),
},
PlanModifiers: []planmodifier.List{
listplanmodifier.RequiresReplace(),
listplanmodifier.UseStateForUnknown(),
},
ElementType: types.ObjectType{
Expand Down Expand Up @@ -348,22 +346,6 @@ func (r *resourceService) ValidateConfig(ctx context.Context, req resource.Valid
}
}

func (r *resourceService) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
// Set alert_grouping_parameters as Computed then "intelligent" type
var pType types.String
var config types.List
resp.Diagnostics.Append(req.Config.GetAttribute(ctx, alertGroupingParametersPath.AtName("type"), &pType)...)
resp.Diagnostics.Append(req.Config.GetAttribute(ctx, alertGroupingParametersPath.AtName("config"), &config)...)
if resp.Diagnostics.HasError() {
return
}
if pType.ValueString() == "intelligent" && config.IsNull() {
resp.Diagnostics.Append(
resp.Plan.SetAttribute(ctx, alertGroupingParametersPath.AtName("config"), types.ListUnknown(alertGroupingParametersConfigObjectType))...,
)
}
}

func (r *resourceService) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var config resourceServiceModel
var model resourceServiceModel
Expand Down Expand Up @@ -1103,8 +1085,6 @@ var (
},
}

alertGroupingParametersPath = path.Root("alert_grouping_parameters").AtListIndex(0)

incidentUrgencyTypeObjectType = types.ObjectType{
AttrTypes: map[string]attr.Type{
"type": types.StringType,
Expand Down
9 changes: 4 additions & 5 deletions pagerdutyplugin/resource_pagerduty_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,8 @@ func TestAccPagerDutyService_AutoPauseNotificationsParameters(t *testing.T) {
"pagerduty_service.foo", "auto_pause_notifications_parameters.#", "1"),
resource.TestCheckResourceAttr(
"pagerduty_service.foo", "auto_pause_notifications_parameters.0.enabled", "false"),
resource.TestCheckResourceAttr(
"pagerduty_service.foo", "auto_pause_notifications_parameters.0.timeout", "0"),
resource.TestCheckNoResourceAttr(
"pagerduty_service.foo", "auto_pause_notifications_parameters.0.timeout"),
),
},
{
Expand All @@ -723,8 +723,8 @@ func TestAccPagerDutyService_AutoPauseNotificationsParameters(t *testing.T) {
"pagerduty_service.foo", "auto_pause_notifications_parameters.#", "1"),
resource.TestCheckResourceAttr(
"pagerduty_service.foo", "auto_pause_notifications_parameters.0.enabled", "false"),
resource.TestCheckResourceAttr(
"pagerduty_service.foo", "auto_pause_notifications_parameters.0.timeout", "0"),
resource.TestCheckNoResourceAttr(
"pagerduty_service.foo", "auto_pause_notifications_parameters.0.timeout"),
),
},
},
Expand Down Expand Up @@ -2027,7 +2027,6 @@ resource "pagerduty_service" "foo" {
incident_urgency_rule {
type = "use_support_hours"
during_support_hours {
type = "constant"
urgency = "high"
Expand Down

0 comments on commit 4099cdb

Please sign in to comment.