From 68991a531026f4cbb9d57fcbc8a2693b2f5151ad Mon Sep 17 00:00:00 2001 From: stack72 Date: Sun, 7 Aug 2016 19:28:14 +1200 Subject: [PATCH] provider/aws: Add an acceptance test that covers the new behaviour in the `aws_iam_group_membership` resource ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSGroupMembership_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSGroupMembership_ -timeout 120m === RUN TestAccAWSGroupMembership_basic --- PASS: TestAccAWSGroupMembership_basic (74.14s) === RUN TestAccAWSGroupMembership_paginatedUserList --- PASS: TestAccAWSGroupMembership_paginatedUserList (273.29s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 347.447s ``` --- .../resource_aws_iam_group_membership_test.go | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/builtin/providers/aws/resource_aws_iam_group_membership_test.go b/builtin/providers/aws/resource_aws_iam_group_membership_test.go index 9fd65b5a6..5b1930543 100644 --- a/builtin/providers/aws/resource_aws_iam_group_membership_test.go +++ b/builtin/providers/aws/resource_aws_iam_group_membership_test.go @@ -57,6 +57,26 @@ func TestAccAWSGroupMembership_basic(t *testing.T) { }) } +func TestAccAWSGroupMembership_paginatedUserList(t *testing.T) { + var group iam.GetGroupOutput + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSGroupMembershipDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSGroupMemberConfigPaginatedUserList, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSGroupMembershipExists("aws_iam_group_membership.team", &group), + resource.TestCheckResourceAttr( + "aws_iam_group_membership.team", "users.#", "101"), + ), + }, + }, + }) +} + func testAccCheckAWSGroupMembershipDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).iamconn @@ -202,3 +222,22 @@ resource "aws_iam_group_membership" "team" { group = "${aws_iam_group.group.name}" } ` + +const testAccAWSGroupMemberConfigPaginatedUserList = ` +resource "aws_iam_group" "group" { + name = "test-paginated-group" + path = "/" +} + +resource "aws_iam_group_membership" "team" { + name = "tf-testing-paginated-group-membership" + users = ["${aws_iam_user.user.*.name}"] + group = "${aws_iam_group.group.name}" +} + +resource "aws_iam_user" "user" { + count = 101 + name = "${format("paged-test-user-%d", count.index + 1)}" + path = "/" +} +`