provider/aws: Fix asg lifecycle hook test (#11995)
Fixes the `TestAccAWSAutoscalingLifecycleHook_omitDefaultResult` acceptance test to run in parallel. ``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAutoscalingLifecycleHook_omitDefaultResult' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/02/15 22:33:26 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAutoscalingLifecycleHook_omitDefaultResult -timeout 120m === RUN TestAccAWSAutoscalingLifecycleHook_omitDefaultResult --- PASS: TestAccAWSAutoscalingLifecycleHook_omitDefaultResult (146.91s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 146.917s ```
This commit is contained in:
parent
3219037359
commit
125641e2bd
|
@ -19,7 +19,7 @@ func TestAccAWSAutoscalingLifecycleHook_basic(t *testing.T) {
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy,
|
CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
{
|
||||||
Config: testAccAWSAutoscalingLifecycleHookConfig(resourceName),
|
Config: testAccAWSAutoscalingLifecycleHookConfig(resourceName),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckLifecycleHookExists("aws_autoscaling_lifecycle_hook.foobar"),
|
testAccCheckLifecycleHookExists("aws_autoscaling_lifecycle_hook.foobar"),
|
||||||
|
@ -34,13 +34,15 @@ func TestAccAWSAutoscalingLifecycleHook_basic(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccAWSAutoscalingLifecycleHook_omitDefaultResult(t *testing.T) {
|
func TestAccAWSAutoscalingLifecycleHook_omitDefaultResult(t *testing.T) {
|
||||||
|
rName := acctest.RandString(10)
|
||||||
|
rInt := acctest.RandInt()
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy,
|
CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
{
|
||||||
Config: testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(acctest.RandString(10)),
|
Config: testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(rName, rInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckLifecycleHookExists("aws_autoscaling_lifecycle_hook.foobar"),
|
testAccCheckLifecycleHookExists("aws_autoscaling_lifecycle_hook.foobar"),
|
||||||
resource.TestCheckResourceAttr("aws_autoscaling_lifecycle_hook.foobar", "default_result", "ABANDON"),
|
resource.TestCheckResourceAttr("aws_autoscaling_lifecycle_hook.foobar", "default_result", "ABANDON"),
|
||||||
|
@ -191,7 +193,7 @@ EOF
|
||||||
`, name, name)
|
`, name, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(name string) string {
|
func testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(name string, rInt int) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "aws_launch_configuration" "foobar" {
|
resource "aws_launch_configuration" "foobar" {
|
||||||
name = "%s"
|
name = "%s"
|
||||||
|
@ -208,7 +210,7 @@ resource "aws_sqs_queue" "foobar" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_iam_role" "foobar" {
|
resource "aws_iam_role" "foobar" {
|
||||||
name = "foobar"
|
name = "foobar-%d"
|
||||||
|
|
||||||
assume_role_policy = <<EOF
|
assume_role_policy = <<EOF
|
||||||
{
|
{
|
||||||
|
@ -276,5 +278,5 @@ EOF
|
||||||
|
|
||||||
notification_target_arn = "${aws_sqs_queue.foobar.arn}"
|
notification_target_arn = "${aws_sqs_queue.foobar.arn}"
|
||||||
role_arn = "${aws_iam_role.foobar.arn}"
|
role_arn = "${aws_iam_role.foobar.arn}"
|
||||||
}`, name, name)
|
}`, name, rInt, name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue