Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/aws: Adding a test for AWS Kinesis Stream Shard Count #5469

Merged
merged 1 commit into from
Mar 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions builtin/providers/aws/resource_aws_kinesis_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,41 @@ func TestAccAWSKinesisStream_basic(t *testing.T) {
})
}

func TestAccAWSKinesisStream_shardCount(t *testing.T) {
var stream kinesis.StreamDescription

ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a nice helper in helper/acctest for this 😉

config := fmt.Sprintf(testAccKinesisStreamConfig, ri)
updateConfig := fmt.Sprintf(testAccKinesisStreamConfigUpdateShardCount, ri)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckKinesisStreamDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: config,
Check: resource.ComposeTestCheckFunc(
testAccCheckKinesisStreamExists("aws_kinesis_stream.test_stream", &stream),
testAccCheckAWSKinesisStreamAttributes(&stream),
resource.TestCheckResourceAttr(
"aws_kinesis_stream.test_stream", "shard_count", "2"),
),
},

resource.TestStep{
Config: updateConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckKinesisStreamExists("aws_kinesis_stream.test_stream", &stream),
testAccCheckAWSKinesisStreamAttributes(&stream),
resource.TestCheckResourceAttr(
"aws_kinesis_stream.test_stream", "shard_count", "4"),
),
},
},
})
}

func TestAccAWSKinesisStream_retentionPeriod(t *testing.T) {
var stream kinesis.StreamDescription

Expand Down Expand Up @@ -161,6 +196,16 @@ resource "aws_kinesis_stream" "test_stream" {
}
`

var testAccKinesisStreamConfigUpdateShardCount = `
resource "aws_kinesis_stream" "test_stream" {
name = "terraform-kinesis-test-%d"
shard_count = 4
tags {
Name = "tf-test"
}
}
`

var testAccKinesisStreamConfigUpdateRetentionPeriod = `
resource "aws_kinesis_stream" "test_stream" {
name = "terraform-kinesis-test-%d"
Expand Down