2015-12-10 02:07:55 +00:00
|
|
|
package kinesis_output
|
|
|
|
|
|
|
|
import (
|
2015-12-10 09:54:30 +00:00
|
|
|
"fmt"
|
2015-12-10 02:07:55 +00:00
|
|
|
"testing"
|
|
|
|
|
2015-12-10 09:54:30 +00:00
|
|
|
"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"
|
2015-12-10 02:07:55 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConnectAndWrite(t *testing.T) {
|
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("Skipping integration test in short mode")
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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{
|
2015-12-10 09:54:30 +00:00
|
|
|
Region: aws.String("us-west-1"),
|
2015-12-10 02:07:55 +00:00
|
|
|
Credentials: credentials.NewChainCredentials(
|
|
|
|
[]credentials.Provider{
|
|
|
|
&ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(session.New())},
|
|
|
|
&credentials.EnvProvider{},
|
|
|
|
&credentials.SharedCredentialsProvider{},
|
|
|
|
}),
|
|
|
|
}
|
2015-12-10 09:54:30 +00:00
|
|
|
svc := kinesis.New(session.New(Config))
|
|
|
|
|
|
|
|
KinesisParams := &kinesis.ListStreamsInput{
|
|
|
|
Limit: aws.Int64(1)}
|
|
|
|
resp, err := svc.ListStreams(KinesisParams)
|
|
|
|
|
|
|
|
fmt.Println(resp)
|
2015-12-10 02:07:55 +00:00
|
|
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|