Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import test refactor for cloudy resources #10607

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 12 additions & 26 deletions aws/resource_aws_cloud9_environment_ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func TestAccAWSCloud9EnvironmentEc2_basic(t *testing.T) {
rString := acctest.RandString(8)
envName := fmt.Sprintf("tf_acc_env_basic_%s", rString)
uEnvName := fmt.Sprintf("tf_acc_env_basic_updated_%s", rString)

resourceName := "aws_cloud9_environment_ec2.test"

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -36,6 +35,12 @@ func TestAccAWSCloud9EnvironmentEc2_basic(t *testing.T) {
resource.TestMatchResourceAttr(resourceName, "owner_arn", regexp.MustCompile(`^arn:`)),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"instance_type"},
},
{
Config: testAccAWSCloud9EnvironmentEc2Config(uEnvName),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -59,7 +64,6 @@ func TestAccAWSCloud9EnvironmentEc2_allFields(t *testing.T) {
description := fmt.Sprintf("Tf Acc Test %s", rString)
uDescription := fmt.Sprintf("Tf Acc Test Updated %s", rString)
userName := fmt.Sprintf("tf_acc_cloud9_env_%s", rString)

resourceName := "aws_cloud9_environment_ec2.test"

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -78,6 +82,12 @@ func TestAccAWSCloud9EnvironmentEc2_allFields(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "type", "ec2"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"instance_type", "automatic_stop_time_minutes", "subnet_id"},
},
{
Config: testAccAWSCloud9EnvironmentEc2AllFieldsConfig(uEnvName, uDescription, userName),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -93,30 +103,6 @@ func TestAccAWSCloud9EnvironmentEc2_allFields(t *testing.T) {
})
}

func TestAccAWSCloud9EnvironmentEc2_importBasic(t *testing.T) {
rString := acctest.RandString(8)
name := fmt.Sprintf("tf_acc_api_doc_part_import_%s", rString)

resourceName := "aws_cloud9_environment_ec2.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloud9(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCloud9EnvironmentEc2Destroy,
Steps: []resource.TestStep{
{
Config: testAccAWSCloud9EnvironmentEc2Config(name),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"instance_type"},
},
},
})
}

func testAccCheckAWSCloud9EnvironmentEc2Exists(n string, res *cloud9.Environment) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
Expand Down
Loading