-
Notifications
You must be signed in to change notification settings - Fork 1.4k
parser_json: Add stream_buffer_size config param #2381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,4 +111,28 @@ def test_parse_with_keep_time_key_without_time_format(data) | |
| assert_equal text, record['time'] | ||
| end | ||
| end | ||
|
|
||
| def test_yajl_parse_io_with_buffer_smaller_than_input | ||
| parser = Fluent::Test::Driver::Parser.new(Fluent::Plugin::JSONParser) | ||
| parser.configure( | ||
| 'keep_time_key' => 'true', | ||
| 'json_parser' => 'yajl', | ||
| 'stream_buffer_size' => 1, | ||
| ) | ||
| text = "100" | ||
|
|
||
| waiting(5) do | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it need? this test suit seems not to block since L134.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it's not actually required for the test to work, I put it there to protect against any regression in the code being tested (or the test scaffolding) that might cause the test to fail, because if it does then it will block forever which would be quite annoying when it runs in CI, if nothing else. |
||
| rd, wr = IO.pipe | ||
| wr.write "{\"time\":\"#{text}\"}" | ||
|
|
||
| parser.instance.parse_io(rd) do |time, record| | ||
| assert_equal text.to_i, time.sec | ||
| assert_equal text, record['time'] | ||
|
|
||
| # Once a record has been received the 'write' end of the pipe must be | ||
| # closed, otherwise the test will block waiting for more input. | ||
| wr.close | ||
| end | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason that this was added was to shave another 30s off the tests