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

This commit is contained in:
stack72 2016-03-05 18:40:47 +01:00
parent d86caf436b
commit d63166c025
1 changed files with 45 additions and 0 deletions

View File

@ -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) { func TestAccAWSKinesisStream_retentionPeriod(t *testing.T) {
var stream kinesis.StreamDescription var stream kinesis.StreamDescription
@ -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 = ` var testAccKinesisStreamConfigUpdateRetentionPeriod = `
resource "aws_kinesis_stream" "test_stream" { resource "aws_kinesis_stream" "test_stream" {
name = "terraform-kinesis-test-%d" name = "terraform-kinesis-test-%d"