From 2cb66ad02cab7f077a13dd9665389c8ae2312b93 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 10 Dec 2015 20:54:30 +1100 Subject: [PATCH] update tests to work properly --- outputs/kinesis/README.md | 1 - outputs/kinesis/kinesis_output_test.go | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/outputs/kinesis/README.md b/outputs/kinesis/README.md index aa37cff4b..3ed4ac377 100644 --- a/outputs/kinesis/README.md +++ b/outputs/kinesis/README.md @@ -41,4 +41,3 @@ kinesis throughput using a different partition key on different hosts or host gr ## todo * Check if the stream exists so that we have a graceful exit. -* Better client smarts to ensure that the plugin operates within the Amazon service limits. \ No newline at end of file diff --git a/outputs/kinesis/kinesis_output_test.go b/outputs/kinesis/kinesis_output_test.go index af8125941..778865c36 100644 --- a/outputs/kinesis/kinesis_output_test.go +++ b/outputs/kinesis/kinesis_output_test.go @@ -1,9 +1,15 @@ package kinesis_output import ( + "fmt" "testing" - "github.com/influxdb/telegraf/testutil" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/kinesis" "github.com/stretchr/testify/require" ) @@ -15,7 +21,7 @@ func TestConnectAndWrite(t *testing.T) { // Verify that we can connect kinesis endpoint. This test allows for a chain of credential // so that various authentication methods can pass depending on the system that executes. Config := &aws.Config{ - Region: aws.String(k.Region), + Region: aws.String("us-west-1"), Credentials: credentials.NewChainCredentials( []credentials.Provider{ &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(session.New())}, @@ -23,7 +29,13 @@ func TestConnectAndWrite(t *testing.T) { &credentials.SharedCredentialsProvider{}, }), } - err := kinesis.New(session.New(Config)) + svc := kinesis.New(session.New(Config)) + + KinesisParams := &kinesis.ListStreamsInput{ + Limit: aws.Int64(1)} + resp, err := svc.ListStreams(KinesisParams) + + fmt.Println(resp) require.NoError(t, err) }