Skip to content

Commit

Permalink
provider/aws: Add an acceptance test that covers the new behaviour in
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
stack72 committed Aug 7, 2016
1 parent 118906e commit 68991a5
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions builtin/providers/aws/resource_aws_iam_group_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = "/"
}
`

0 comments on commit 68991a5

Please sign in to comment.