MCPcopy Create free account
hub / github.com/Edgio/vflow / TestUnknownDatasetsMessage

Function TestUnknownDatasetsMessage

ipfix/decoder_test.go:199–213  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

197}
198
199func TestUnknownDatasetsMessage(t *testing.T) {
200 ip := net.ParseIP("127.0.0.1")
201 mCache := GetCache("cache.file")
202 d := NewDecoder(ip, unknownDatasetMessage)
203 r, err := d.Decode(mCache)
204 if l := len(r.DataSets); l != 0 {
205 t.Error("Did not expect any result datasets, but got", l)
206 }
207 expectedErrorStr := `Multiple errors:
208- 127.0.0.1 unknown ipfix template id# 264
209- 127.0.0.1 unknown ipfix template id# 264`
210 if err == nil || err.Error() != expectedErrorStr {
211 t.Error("Received unexpected erorr:", err)
212 }
213}
214
215func TestDecodeDataTpl(t *testing.T) {
216 var payload = []byte{0, 10, 1, 32, 92, 88, 61, 168, 0, 1, 117, 38, 0, 0, 0, 0, 4, 0, 0, 120, 0, 0, 1, 104, 184, 176, 218, 137, 0, 0, 1, 104, 184, 176, 211, 113, 0, 0, 0, 0, 0, 0, 3, 72, 0, 0, 0, 0, 0, 0, 0, 10, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 2, 15, 216, 58, 215, 99, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 104, 184, 176, 218, 137, 0, 0, 1, 104, 184, 176, 211, 113, 0, 0, 0, 0, 0, 0, 3, 72, 0, 0, 0, 0, 0, 0, 0, 10, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 58, 215, 99, 10, 0, 2, 15, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 0, 0, 88, 0, 0, 1, 104, 184, 172, 62, 242, 0, 0, 1, 104, 184, 172, 62, 242, 0, 0, 0, 0, 0, 0, 0, 189, 0, 0, 0, 0, 0, 0, 0, 1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 128, 0, 0, 0, 0, 0, 0, 31, 12, 114, 32, 178, 94, 204, 189, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251, 0, 20, 233, 20, 233, 0, 17, 0, 0, 0, 4, 0, 0, 64, 0, 0, 1, 104, 184, 172, 62, 242, 0, 0, 1, 104, 184, 172, 62, 242, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 2, 15, 224, 0, 0, 251, 20, 233, 20, 233, 0, 0, 17, 0, 0, 0}

Callers

nothing calls this directly

Calls 3

DecodeMethod · 0.95
GetCacheFunction · 0.70
NewDecoderFunction · 0.70

Tested by

no test coverage detected