logstash-plugins / logstash-input-stdin

Apache License 2.0
6 stars 16 forks source link

Fix ECS test failure cases. #23

Closed mashhurs closed 1 year ago

mashhurs commented 1 year ago

Description

This change fixes the test case failure, example failure.

Details: the root cause for test failure is, we ca calling directly process() method of the plugin. For the real scenarios, StdinChannel::Reader.new or standard $stdin escapes the new line. So, in the test cases, changed plugin default Line codec to JSON codec to avoid the new line (\n).

mashhurs commented 1 year ago

@mashhurs Thanks for improving the test cases. I have one suggestion to make the test case aligned with the others.

@kaisecheng if we align on default Line codec, the solution would be

expect( event.get('[event][original]').strip ).to eql stdin_data.strip

and I have applied it.

Details: we receive the data with \n (new line) in 7.x with ECS disabled because we are directly calling process(), so need to apply the strip on both received event and expected data.