Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/resource/aws_elastic_beanstalk_environment: Refactoring and mod…
…ernization (#11702) Previously in the acceptance testing (across entire resource): ``` --- FAIL: TestAccAWSBeanstalkEnv_basic (20.78s) testing.go:640: Step 0 error: errors during apply: Error: Error waiting for Elastic Beanstalk Environment (e-mua2t3mjij) to become ready: 2 errors occurred: * 2020-01-21 07:33:24.327 +0000 UTC (e-mua2t3mjij) : Service:AmazonCloudFormation, Message:Parameter InstanceType failed to satisfy constraint: must be a valid EC2 instance type. * 2020-01-21 07:33:24.426 +0000 UTC (e-mua2t3mjij) : Failed to launch environment. --- FAIL: TestAccAWSBeanstalkEnv_settingWithJsonValue (0.73s) testing.go:640: Step 0 error: /opt/teamcity-agent/temp/buildTmp/tf-test536039886/main.tf:74,3-10: Attribute redefined; The argument "setting" was already set at /opt/teamcity-agent/temp/buildTmp/tf-test536039886/main.tf:68,3-10. Each argument may be set only once., and 19 other diagnostic(s) ``` The test configurations were previously written to expect either a Elastic Beanstalk compatible Default VPC (IGW, map public IPs on launch Subnets, and permissive ingress/egress NACL) or EC2-Classic. We have moved away from these expectations and the majority of this refactor is centered on supplying self-contained VPC configurations to each test. Other changes include: - Blocking usw2-az4 as the default instance type for EB is t2.micro and that instance type is not available in that Availability Zone, always (when that subnet is selected) triggering a launch error - Migrating to import testing in most tests - Migrating to resources named "test" in configurations and single resourceName variable in functions - Migrating to single rName variable for randomization - Using helper TestCheckFunc for ARNs - Removing duplicate test functions and configurations Especially given the new import testing, there are potential further fixes that could be done to this resource including properly setting the `setting` and `template_name` attributes into the Terraform state during refresh, however those changes to the resource logic are out of scope for these test fixes. Output from acceptance testing: ``` --- PASS: TestAccAWSBeanstalkEnv_platformArn (410.22s) --- PASS: TestAccAWSBeanstalkEnv_resource (439.66s) --- PASS: TestAccAWSBeanstalkEnv_basic (489.82s) --- PASS: TestAccAWSBeanstalkEnv_settingWithJsonValue (558.85s) --- PASS: TestAccAWSBeanstalkEnv_cname_prefix (577.42s) --- PASS: TestAccAWSBeanstalkEnv_version_label (618.65s) --- PASS: TestAccAWSBeanstalkEnv_config (628.04s) --- PASS: TestAccAWSBeanstalkEnv_tier (630.63s) --- PASS: TestAccAWSBeanstalkEnv_tags (667.96s) --- PASS: TestAccAWSBeanstalkEnv_settings_update (744.56s) --- PASS: TestAccAWSBeanstalkEnv_template_change (768.69s) ```
- Loading branch information