Skip to content

Commit

Permalink
switch to using depends_on
Browse files Browse the repository at this point in the history
  • Loading branch information
austinvalle committed Nov 13, 2024
1 parent a504cf7 commit 926ba3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 34 deletions.
25 changes: 8 additions & 17 deletions internal/framework5provider/ephemeral_lifecycle_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/hashicorp/terraform-plugin-testing/echoprovider"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
"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-plugin-testing/tfversion"
)

Expand All @@ -43,20 +40,14 @@ func TestEphemeralLifecycleResource_basic(t *testing.T) {
},
Steps: []resource.TestStep{
{
Config: addEchoToEphemeralLifecycleConfig(`
ephemeral "framework_lifecycle" "test" {
name = "John Doe"
}
resource "time_sleep" "wait_20_seconds" {
create_duration = "20s"
triggers = {
name = echo.lifecycle_test.data.name
}
}`),
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue("echo.lifecycle_test", tfjsonpath.New("data").AtMapKey("name"), knownvalue.StringExact("John Doe")),
statecheck.ExpectKnownValue("echo.lifecycle_test", tfjsonpath.New("data").AtMapKey("token"), knownvalue.StringExact("fake-token-12345")),
},
Config: `
ephemeral "framework_lifecycle" "test" {
name = "John Doe"
}
resource "time_sleep" "wait_20_seconds" {
depends_on = [ephemeral.framework_lifecycle.test]
create_duration = "20s"
}`,
},
},
CheckDestroy: func(_ *terraform.State) error {
Expand Down
25 changes: 8 additions & 17 deletions internal/framework6provider/ephemeral_lifecycle_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/hashicorp/terraform-plugin-testing/echoprovider"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
"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-plugin-testing/tfversion"
)

Expand All @@ -40,20 +37,14 @@ func TestEphemeralLifecycleResource_basic(t *testing.T) {
},
Steps: []resource.TestStep{
{
Config: addEchoToEphemeralLifecycleConfig(`
ephemeral "framework_lifecycle" "test" {
name = "John Doe"
}
resource "time_sleep" "wait_20_seconds" {
create_duration = "20s"
triggers = {
name = echo.lifecycle_test.data.name
}
}`),
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue("echo.lifecycle_test", tfjsonpath.New("data").AtMapKey("name"), knownvalue.StringExact("John Doe")),
statecheck.ExpectKnownValue("echo.lifecycle_test", tfjsonpath.New("data").AtMapKey("token"), knownvalue.StringExact("fake-token-12345")),
},
Config: `
ephemeral "framework_lifecycle" "test" {
name = "John Doe"
}
resource "time_sleep" "wait_20_seconds" {
depends_on = [ephemeral.framework_lifecycle.test]
create_duration = "20s"
}`,
},
},
CheckDestroy: func(_ *terraform.State) error {
Expand Down

0 comments on commit 926ba3a

Please sign in to comment.