@@ -20,21 +20,25 @@ func TestKafkaEventMarshaling(t *testing.T) {
2020 t .Errorf ("could not unmarshal event. details: %v" , err )
2121 }
2222
23+ assert .Equal (t , inputEvent .BootstrapServers , "b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092" )
24+ assert .Equal (t , inputEvent .EventSource , "aws:kafka" )
25+ assert .Equal (t , inputEvent .EventSourceARN , "arn:aws:kafka:us-west-2:012345678901:cluster/ExampleMSKCluster/e9f754c6-d29a-4430-a7db-958a19fd2c54-4" )
2326 for _ , records := range inputEvent .Records {
2427 for _ , record := range records {
2528 utc := record .Timestamp .UTC ()
2629 assert .Equal (t , 2020 , utc .Year ())
30+ assert .Equal (t , record .Key , "OGQ1NTk2YjQtMTgxMy00MjM4LWIyNGItNmRhZDhlM2QxYzBj" )
31+ assert .Equal (t , record .Value , "OGQ1NTk2YjQtMTgxMy00MjM4LWIyNGItNmRhZDhlM2QxYzBj" )
32+
33+ for _ , header := range record .Headers {
34+ for key , value := range header {
35+ assert .Equal (t , key , "headerKey" )
36+ var headerValue string = string (value )
37+ assert .Equal (t , headerValue , "headerValue" )
38+ }
39+ }
2740 }
2841 }
29-
30- // 3. serialize to JSON
31- outputJson , err := json .Marshal (inputEvent )
32- if err != nil {
33- t .Errorf ("could not marshal event. details: %v" , err )
34- }
35-
36- // 4. check result
37- assert .JSONEq (t , string (inputJson ), string (outputJson ))
3842}
3943
4044func TestKafkaMarshalingMalformedJson (t * testing.T ) {
0 commit comments