Skip to content

Commit 125641e

Browse files
grubernautstack72
authored andcommitted
provider/aws: Fix asg lifecycle hook test (hashicorp#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 ```
1 parent 3219037 commit 125641e

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎builtin/providers/aws/resource_aws_autoscaling_lifecycle_hook_test.go‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestAccAWSAutoscalingLifecycleHook_basic(t *testing.T) {
1919
Providers: testAccProviders,
2020
CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy,
2121
Steps: []resource.TestStep{
22-
resource.TestStep{
22+
{
2323
Config: testAccAWSAutoscalingLifecycleHookConfig(resourceName),
2424
Check: resource.ComposeTestCheckFunc(
2525
testAccCheckLifecycleHookExists("aws_autoscaling_lifecycle_hook.foobar"),
@@ -34,13 +34,15 @@ func TestAccAWSAutoscalingLifecycleHook_basic(t *testing.T) {
3434
}
3535

3636
func TestAccAWSAutoscalingLifecycleHook_omitDefaultResult(t *testing.T) {
37+
rName := acctest.RandString(10)
38+
rInt := acctest.RandInt()
3739
resource.Test(t, resource.TestCase{
3840
PreCheck: func() { testAccPreCheck(t) },
3941
Providers: testAccProviders,
4042
CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy,
4143
Steps: []resource.TestStep{
42-
resource.TestStep{
43-
Config: testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(acctest.RandString(10)),
44+
{
45+
Config: testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(rName, rInt),
4446
Check: resource.ComposeTestCheckFunc(
4547
testAccCheckLifecycleHookExists("aws_autoscaling_lifecycle_hook.foobar"),
4648
resource.TestCheckResourceAttr("aws_autoscaling_lifecycle_hook.foobar", "default_result", "ABANDON"),
@@ -191,7 +193,7 @@ EOF
191193
`, name, name)
192194
}
193195

194-
func testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(name string) string {
196+
func testAccAWSAutoscalingLifecycleHookConfig_omitDefaultResult(name string, rInt int) string {
195197
return fmt.Sprintf(`
196198
resource "aws_launch_configuration" "foobar" {
197199
name = "%s"
@@ -208,7 +210,7 @@ resource "aws_sqs_queue" "foobar" {
208210
}
209211
210212
resource "aws_iam_role" "foobar" {
211-
name = "foobar"
213+
name = "foobar-%d"
212214
213215
assume_role_policy = <<EOF
214216
{
@@ -276,5 +278,5 @@ EOF
276278
277279
notification_target_arn = "${aws_sqs_queue.foobar.arn}"
278280
role_arn = "${aws_iam_role.foobar.arn}"
279-
}`, name, name)
281+
}`, name, rInt, name)
280282
}

0 commit comments

Comments
 (0)