Skip to content

Commit

Permalink
fixed merge conflict and fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TiganeteaRobert committed Aug 23, 2022
1 parent 4a2ba63 commit bfaa707
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion pkg/source/kinesis/kinesis_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestNewKinesisSourceWithInterfaces_ConnectionCheck(t *testing.T) {
kinesisClient := testutil.GetAWSLocalstackKinesisClient()
dynamodbClient := testutil.GetAWSLocalstackDynamoDBClient()

_, err := newKinesisSourceWithInterfaces(kinesisClient, dynamodbClient, "00000000000", 15, testutil.AWSLocalstackRegion, "nonexistent-stream", "test", nil)
_, err := newKinesisSourceWithInterfaces(kinesisClient, dynamodbClient, "00000000000", 15, testutil.AWSLocalstackRegion, "nonexistent-stream", "test", nil, 10, 10, nil)

if err != nil {
assert.Equal("ResourceNotFoundException: Stream nonexistent-stream under account 000000000000 not found.", err.Error())
Expand Down Expand Up @@ -259,13 +259,41 @@ func TestGetSource_ConfigErrorLeaderAction(t *testing.T) {

assert := assert.New(t)

// Set up localstack resources
kinesisClient := testutil.GetAWSLocalstackKinesisClient()
dynamodbClient := testutil.GetAWSLocalstackDynamoDBClient()

streamName := "kinesis-source-integration-2"
createErr := testutil.CreateAWSLocalstackKinesisStream(kinesisClient, streamName)
if createErr != nil {
t.Fatal(createErr)
}
defer testutil.DeleteAWSLocalstackKinesisStream(kinesisClient, streamName)

appName := "integration"
ddbErr := testutil.CreateAWSLocalstackDynamoDBTables(dynamodbClient, appName)
if ddbErr != nil {
t.Fatal(ddbErr)
}
defer testutil.DeleteAWSLocalstackDynamoDBTables(dynamodbClient, appName)

// Put ten records into kinesis stream
putErr := putNRecordsIntoKinesis(kinesisClient, 10, streamName, "Test")
if putErr != nil {
t.Fatal(putErr)
}

time.Sleep(1 * time.Second)

// Create the source and assert that it's there
source, err := newKinesisSourceWithInterfaces(kinesisClient, dynamodbClient, "00000000000", 15, testutil.AWSLocalstackRegion, "something", "test", nil, 0, 10, &one)

assert.Nil(source)
assert.EqualError(err, `Failed to create Kinsumer client: leaderActionFrequency config value is mandatory and must be at least as long as ShardCheckFrequency`)

if testing.Short() {
t.Skip("skipping integration test")
}
}

func TestGetSource_ConfigErrorMaxAge(t *testing.T) {
Expand Down

0 comments on commit bfaa707

Please sign in to comment.