Skip to content

Commit

Permalink
Merge pull request #5469 from stack72/b-aws-kinesis-stream-shardcount
Browse files Browse the repository at this point in the history
provider/aws: Adding a test for AWS Kinesis Stream Shard Count
  • Loading branch information
stack72 committed Mar 5, 2016
2 parents 75679a1 + d63166c commit eda1230
Showing 1 changed file with 45 additions and 0 deletions.
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()
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

0 comments on commit eda1230

Please sign in to comment.