Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyal-Be committed Sep 5, 2024
1 parent 99b4c82 commit 77d564e
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions port/action/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
},
},
})
}

0 comments on commit 77d564e

Please sign in to comment.