-
Notifications
You must be signed in to change notification settings - Fork 23
Add decode_size_limit_bytes option. #30
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
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -117,6 +117,22 @@ | |
end | ||
end | ||
|
||
describe "decode_size_limits_bytes" do | ||
let(:maximum_payload) { "a" * subject.decode_size_limit_bytes } | ||
|
||
it "should not raise an error if the number of bytes is not exceeded" do | ||
expect { | ||
subject.decode(maximum_payload) | ||
}.not_to raise_error | ||
end | ||
|
||
it "should raise an error if the max bytes are exceeded" do | ||
expect { | ||
subject.decode(maximum_payload << "z") | ||
}.to raise_error(RuntimeError, "input buffer full") | ||
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. is there a way to provide more context to this exception? 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. Unfortunately that exception is provided by the FileWatch library, so it'd require a patch there. I should probably wrap and re-raise it. 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. I just submitted https://github.com/jordansissel/ruby-filewatch/pull/82/files to enable us to catch a more precise exception. |
||
end | ||
end | ||
|
||
end | ||
|
||
context "#encode" do | ||
|
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.
decode
the right name? The description says this is bytes for a line, but then we call itdecode
which isn't something mentioned elsewhere in the docs.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.
If the size limit is exceeded, where do we show that this exception will terminate Logstash? I don't see it when I read through the code.