diff --git a/port/action/resource_test.go b/port/action/resource_test.go index c896eee1..a1d577c4 100644 --- a/port/action/resource_test.go +++ b/port/action/resource_test.go @@ -2192,3 +2192,75 @@ func TestRequiredApprovalAll(t *testing.T) { }, }) } + +func TestAccPortActionSort(t *testing.T) { + identifier := utils.GenID() + actionIdentifier := utils.GenID() + var testAccActionConfigCreate = testAccCreateBlueprintConfig(identifier) + fmt.Sprintf(` + resource "port_action" "create_microservice" { + title = "TF Provider Test" + identifier = "%[1]v" + icon = "Terraform" + self_service_trigger = { + operation = "DAY-2" + blueprint_identifier = port_blueprint.microservice.identifier + user_properties = { + "string_props" = { + "myEntityIdentifier" = { + "title" = "My entity Identifier" + "format" = "entity" + "blueprint" = "'%[2]v'" + "sort" = { + "order" = "DESC" + "property" = "timer" + } + "required" = false + } + } + "array_props" = { + "myEntityIdentifiers" = { + "title" = "My entity Identifiers" + string_items = { + "format" = "entity" + "blueprint" = "'%[2]v'" + } + "sort" = { + "order" = "ASC" + "property" = "timer" + } + "required" = false + } + } + } + } + kafka_method = {} + }`, actionIdentifier, identifier) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: acctest.ProviderConfig + testAccActionConfigCreate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("port_action.create_microservice", "title", "TF Provider Test"), + resource.TestCheckResourceAttr("port_action.create_microservice", "identifier", actionIdentifier), + resource.TestCheckResourceAttr("port_action.create_microservice", "icon", "Terraform"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.blueprint_identifier", identifier), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.operation", "DAY-2"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.string_props.myEntityIdentifier.title", "My entity Identifier"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.string_props.myEntityIdentifier.format", "entity"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.string_props.myEntityIdentifier.blueprint", identifier), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.string_props.myEntityIdentifier.sort.order", "DESC"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.string_props.myEntityIdentifier.sort.property", "timer"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.array_props.myEntityIdentifiers.title", "My entity Identifiers"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.array_props.myEntityIdentifiers.sort.order", "ASC"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.array_props.myEntityIdentifiers.sort.order", "timer"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.array_props.myArrayIdentifier.string_items.format", "entity"), + resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.user_properties.array_props.myArrayIdentifier.string_items.blueprint", identifier), + ), + }, + }, + }) +} +