Skip to content

Commit

Permalink
test(streams): Add a test-case for the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu committed Jul 11, 2018
1 parent 2be04d3 commit 056e1c0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions streams/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,28 @@ func TestPublishEvents(t *testing.T) {
}
}

{
// Records with nil error codes should be ignored with some log
client.encoder = StubCodec{dat: []byte("boom"), err: nil}
client.streams = StubClient{
out: &kinesis.PutRecordsOutput{
Records: []*kinesis.PutRecordsResultEntry{
&kinesis.PutRecordsResultEntry{
ErrorCode: nil,
},
},
FailedRecordCount: aws.Int64(1),
},
}
rest, err := client.publishEvents(events)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if len(rest) != 0 {
t.Errorf("unexpected number of remaining events: %d", len(rest))
}
}

{
// Kinesis received the event but it was not persisted, probably due to underlying infrastructure failure
client.encoder = StubCodec{dat: []byte("boom"), err: nil}
Expand Down

0 comments on commit 056e1c0

Please sign in to comment.