diff --git a/events/firehose.go b/events/firehose.go index 9a7a34a2..80ce098e 100644 --- a/events/firehose.go +++ b/events/firehose.go @@ -39,5 +39,6 @@ type KinesisFirehoseRecordMetadata struct { ShardID string `json:"shardId"` PartitionKey string `json:"partitionKey"` SequenceNumber string `json:"sequenceNumber"` + SubsequenceNumber string `json:"subsequenceNumber"` ApproximateArrivalTimestamp MilliSecondsEpochTime `json:"approximateArrivalTimestamp"` } diff --git a/events/firehose_test.go b/events/firehose_test.go index 34c9d146..ae7dbfc2 100644 --- a/events/firehose_test.go +++ b/events/firehose_test.go @@ -11,20 +11,19 @@ import ( "github.com/stretchr/testify/assert" ) -func testFirehoseEventMarshaling(t *testing.T) { - testMarshaling(t, "./testdata/kinesis-firehose-event.json") +func TestFirehoseEventMarshaling(t *testing.T) { + testMarshaling(t, &KinesisFirehoseEvent{}, "./testdata/kinesis-firehose-event.json") } -func testFirehoseResponseMarshaling(t *testing.T) { - testMarshaling(t, "./testdata/kinesis-firehose-response.json") +func TestFirehoseResponseMarshaling(t *testing.T) { + testMarshaling(t, &KinesisFirehoseResponse{}, "./testdata/kinesis-firehose-response.json") } -func testMarshaling(t *testing.T, jsonFile string) { +func testMarshaling(t *testing.T, inputEvent interface{}, jsonFile string) { // 1. read JSON from file inputJson := test.ReadJSONFromFile(t, jsonFile) // 2. de-serialize into Go object - var inputEvent KinesisFirehoseEvent if err := json.Unmarshal(inputJson, &inputEvent); err != nil { t.Errorf("could not unmarshal event. details: %v", err) } diff --git a/events/testdata/kinesis-firehose-event.json b/events/testdata/kinesis-firehose-event.json index 07423de4..e57977ce 100644 --- a/events/testdata/kinesis-firehose-event.json +++ b/events/testdata/kinesis-firehose-event.json @@ -13,7 +13,7 @@ "partitionKey": "4d1ad2b9-24f8-4b9d-a088-76e9947c317a", "approximateArrivalTimestamp": 1507217624302, "sequenceNumber": "49546986683135544286507457936321625675700192471156785154", - "subsequenceNumber": "" + "subsequenceNumber": "123456" } }, { @@ -25,7 +25,7 @@ "partitionKey": "4d1ad2b9-24f8-4b9d-a088-76e9947c318a", "approximateArrivalTimestamp": 1507217624302, "sequenceNumber": "49546986683135544286507457936321625675700192471156785155", - "subsequenceNumber": "" + "subsequenceNumber": "123457" } } ]