Skip to content

Commit

Permalink
Merge pull request #10099 from terraform-providers/rfd-at002-glacier
Browse files Browse the repository at this point in the history
Import test refactor for glacier vault
  • Loading branch information
ryndaniels authored Sep 19, 2019
2 parents 53e15a2 + 8e1df33 commit e8a5d81
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions aws/resource_aws_glacier_vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ import (
"github.com/hashicorp/terraform/terraform"
)

func TestAccAWSGlacierVault_importBasic(t *testing.T) {
resourceName := "aws_glacier_vault.full"
func TestAccAWSGlacierVault_basic(t *testing.T) {
rInt := acctest.RandInt()
resourceName := "aws_glacier_vault.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckGlacierVaultDestroy,
Steps: []resource.TestStep{
{
Config: testAccGlacierVault_full(rInt),
Config: testAccGlacierVault_basic(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckGlacierVaultExists(resourceName),
),
},

{
ResourceName: resourceName,
ImportState: true,
Expand All @@ -36,25 +38,10 @@ func TestAccAWSGlacierVault_importBasic(t *testing.T) {
})
}

func TestAccAWSGlacierVault_basic(t *testing.T) {
rInt := acctest.RandInt()
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckGlacierVaultDestroy,
Steps: []resource.TestStep{
{
Config: testAccGlacierVault_basic(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckGlacierVaultExists("aws_glacier_vault.test"),
),
},
},
})
}

func TestAccAWSGlacierVault_full(t *testing.T) {
rInt := acctest.RandInt()
resourceName := "aws_glacier_vault.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand All @@ -63,15 +50,22 @@ func TestAccAWSGlacierVault_full(t *testing.T) {
{
Config: testAccGlacierVault_full(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckGlacierVaultExists("aws_glacier_vault.full"),
testAccCheckGlacierVaultExists(resourceName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAWSGlacierVault_RemoveNotifications(t *testing.T) {
rInt := acctest.RandInt()
resourceName := "aws_glacier_vault.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand All @@ -80,14 +74,19 @@ func TestAccAWSGlacierVault_RemoveNotifications(t *testing.T) {
{
Config: testAccGlacierVault_full(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckGlacierVaultExists("aws_glacier_vault.full"),
testAccCheckGlacierVaultExists(resourceName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccGlacierVault_withoutNotification(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckGlacierVaultExists("aws_glacier_vault.full"),
testAccCheckVaultNotificationsMissing("aws_glacier_vault.full"),
testAccCheckGlacierVaultExists(resourceName),
testAccCheckVaultNotificationsMissing(resourceName),
),
},
},
Expand Down Expand Up @@ -245,7 +244,7 @@ resource "aws_sns_topic" "aws_sns_topic" {
name = "glacier-sns-topic-%d"
}
resource "aws_glacier_vault" "full" {
resource "aws_glacier_vault" "test" {
name = "my_test_vault_%d"
notification {
Expand All @@ -266,7 +265,7 @@ resource "aws_sns_topic" "aws_sns_topic" {
name = "glacier-sns-topic-%d"
}
resource "aws_glacier_vault" "full" {
resource "aws_glacier_vault" "test" {
name = "my_test_vault_%d"
tags = {
Expand Down

0 comments on commit e8a5d81

Please sign in to comment.