Skip to content

Commit

Permalink
fixed a typo and improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pazhersh committed Sep 8, 2024
1 parent dafdcdb commit 5ef9011
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions port/action/actionStateToPortBody.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func triggerToBody(ctx context.Context, data *ActionModel) (*cli.Trigger, error)

if data.AutomationTrigger.RunCreatedEvent != nil {
automationTrigger.Event = &cli.TriggerEvent{
Type: consts.RunUpdated,
Type: consts.RunCreated,
ActionIdentifier: data.AutomationTrigger.RunCreatedEvent.ActionIdentifier.ValueStringPointer(),
}
}
Expand All @@ -181,7 +181,7 @@ func triggerToBody(ctx context.Context, data *ActionModel) (*cli.Trigger, error)

if data.AutomationTrigger.AnyRunChangeEvent != nil {
automationTrigger.Event = &cli.TriggerEvent{
Type: consts.RunUpdated,
Type: consts.AnyRunChange,
ActionIdentifier: data.AutomationTrigger.AnyRunChangeEvent.ActionIdentifier.ValueStringPointer(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion port/action/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ type AutomationTriggerModel struct {
TimerPropertyExpiredEvent *TimerPropertyExpiredEventModel `tfsdk:"timer_property_expired_event"`
RunCreatedEvent *RunCreatedEvent `tfsdk:"run_created_event"`
RunUpdatedEvent *RunUpdatedEvent `tfsdk:"run_updated_event"`
AnyRunChangeEvent *AnyRunChangeEvent `tfsdk:"any_run_chnage_event"`
AnyRunChangeEvent *AnyRunChangeEvent `tfsdk:"any_run_change_event"`
JqCondition *JqConditionModel `tfsdk:"jq_condition"`
}

Expand Down
18 changes: 18 additions & 0 deletions port/action/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,12 @@ func TestAccPortAutomationRunCreated(t *testing.T) {
resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.run_created_event.action_identifier", "self_serve_action"),
),
},
{
ResourceName: "port_action.create_microservice",
ImportState: true,
ImportStateVerify: true,
ImportStateId: actionIdentifier,
},
},
})
}
Expand Down Expand Up @@ -1653,6 +1659,12 @@ func TestAccPortAutomationRunUpdated(t *testing.T) {
resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.run_updated_event.action_identifier", "self_serve_action"),
),
},
{
ResourceName: "port_action.create_microservice",
ImportState: true,
ImportStateVerify: true,
ImportStateId: actionIdentifier,
},
},
})
}
Expand Down Expand Up @@ -1698,6 +1710,12 @@ func TestAccPortAutomationAnyRunChange(t *testing.T) {
resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.any_run_change_event.action_identifier", "self_serve_action"),
),
},
{
ResourceName: "port_action.create_microservice",
ImportState: true,
ImportStateVerify: true,
ImportStateId: actionIdentifier,
},
},
})
}
Expand Down

0 comments on commit 5ef9011

Please sign in to comment.