Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
27
pkg/kafka/unhandled_msg_test.go
Normal file
27
pkg/kafka/unhandled_msg_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package kafka_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"fiskerinc.com/modules/common"
|
||||
"fiskerinc.com/modules/kafka"
|
||||
"fiskerinc.com/modules/testhelper"
|
||||
)
|
||||
|
||||
func TestErrUnhandledMessage(t *testing.T) {
|
||||
id := "11111111111111111"
|
||||
handler := "non_existent"
|
||||
payload := []byte(`{"data":"payload"}`)
|
||||
expectedTrexErr := `unhandled message, device: trex, id: 11111111111111111 handler: non_existent, payload: {"data":"payload"}`
|
||||
expectedHMIErr := `unhandled message, device: hmi, id: 11111111111111111 handler: non_existent, payload: [123 34 100 97 116 97 34 58 34 112 97 121 108 111 97 100 34 125]`
|
||||
|
||||
err := kafka.ErrUnhandledMessage(common.TRex, id, handler, string(payload))
|
||||
if err.Error() != expectedTrexErr {
|
||||
t.Errorf(testhelper.TestErrorTemplate, "trex message", expectedTrexErr, err.Error())
|
||||
}
|
||||
|
||||
err = kafka.ErrUnhandledMessage(common.HMI, id, handler, payload)
|
||||
if err.Error() != expectedHMIErr {
|
||||
t.Errorf(testhelper.TestErrorTemplate, "hmi message", expectedHMIErr, err.Error())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user