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
```
This commit is contained in:
stack72 2016-08-07 19:28:14 +12:00
parent 118906ed07
commit 68991a5310
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
1 changed files with 39 additions and 0 deletions

View File

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