Skip to content

Commit e59afad

Browse files
committed
Add test
Signed-off-by: chrismark <chrismarkou92@gmail.com>
1 parent 67dcd5f commit e59afad

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

libbeat/reader/readjson/docker_json_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,20 @@ func TestDockerJSON(t *testing.T) {
330330
Bytes: 97,
331331
},
332332
},
333+
{
334+
name: "Corrupted log message line is skipped, keep correct bytes count",
335+
input: [][]byte{
336+
[]byte(`36.276 # User requested shutdown...\n","stream":"stdout","time":"2017-11-09T13:27:36.277747246Z"}`),
337+
[]byte(`{"log":"1:M 09 Nov 13:27:36.276 # User requested","stream":"stdout","time":"2017-11-09T13:27:36.277747246Z"}`),
338+
},
339+
stream: "all",
340+
expectedMessage: reader.Message{
341+
Content: []byte("1:M 09 Nov 13:27:36.276 # User requested"),
342+
Fields: common.MapStr{"stream": "stdout"},
343+
Ts: time.Date(2017, 11, 9, 13, 27, 36, 277747246, time.UTC),
344+
Bytes: 205,
345+
},
346+
},
333347
}
334348

335349
for _, test := range tests {

0 commit comments

Comments
 (0)