Skip to content

Commit

Permalink
Add 'TestAccBedrockAgentAgentActionGroup_upgradeToPrepareAgent'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Oct 3, 2024
1 parent 9f95b20 commit 8becdad
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions internal/service/bedrockagent/agent_action_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ import (
awstypes "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types"
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
"github.com/hashicorp/terraform-plugin-testing/plancheck"
"github.com/hashicorp/terraform-plugin-testing/statecheck"
"github.com/hashicorp/terraform-plugin-testing/terraform"
"github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
tfplancheck "github.com/hashicorp/terraform-provider-aws/internal/acctest/plancheck"
tfstatecheck "github.com/hashicorp/terraform-provider-aws/internal/acctest/statecheck"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
tfbedrockagent "github.com/hashicorp/terraform-provider-aws/internal/service/bedrockagent"
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
Expand Down Expand Up @@ -62,6 +68,57 @@ func TestAccBedrockAgentAgentActionGroup_basic(t *testing.T) {
})
}

func TestAccBedrockAgentAgentActionGroup_upgradeToPrepareAgent(t *testing.T) {
ctx := acctest.Context(t)
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
resourceName := "aws_bedrockagent_agent_action_group.test"
var v awstypes.AgentActionGroup

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckPartitionHasService(t, names.BedrockEndpointID) },
ErrorCheck: acctest.ErrorCheck(t, names.BedrockAgentServiceID),
CheckDestroy: testAccCheckAgentActionGroupDestroy(ctx),
Steps: []resource.TestStep{
{
ExternalProviders: map[string]resource.ExternalProvider{
"aws": {
Source: "hashicorp/aws",
VersionConstraint: "5.69.0",
},
},
Config: testAccAgentActionGroupConfig_basic(rName),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
},
},
ConfigStateChecks: []statecheck.StateCheck{
tfstatecheck.ExpectNoValue(resourceName, tfjsonpath.New("prepare_agent")),
},
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAgentActionGroupExists(ctx, resourceName, &v),
),
},
{
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Config: testAccAgentActionGroupConfig_basic(rName),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate),
tfplancheck.ExpectKnownValueChange(resourceName, tfjsonpath.New("prepare_agent"), knownvalue.Null(), knownvalue.Bool(true)),
},
},
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("prepare_agent"), knownvalue.Bool(true)),
},
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAgentActionGroupExists(ctx, resourceName, &v),
),
},
},
})
}

func TestAccBedrockAgentAgentActionGroup_APISchema_s3(t *testing.T) {
ctx := acctest.Context(t)
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
Expand Down

0 comments on commit 8becdad

Please sign in to comment.