-
Notifications
You must be signed in to change notification settings - Fork 55
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
Updates for JRuby 9.4 #125
Conversation
…ialized. With this commit defines the list of permitted_classes to be used by the deserializer.
… error like: ``` expected: ("HOME") got: ("GEM_REQUIREMENT_LOGSTASH-CODEC-PLAIN") Please stub a default value first if message might be received with other args as well ```
With Ruby 3.1 and new version of Psych 4 (YAML parser) the `load` method which was an alias for `unsafe_load` has been moved to be an alias for `safe_load`. This commit default the calls to old aliased method: `unsafe_load`. Ref: https://www.ctrl.blog/entry/ruby-psych4.html
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.
Code changes look good to me, but can we please add unit tests for the value tracker?
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.
Thank you for adding a test! Can we add a couple more to make sure we cover read/write across all scenarios?
|
||
let(:yaml_date_source) { "--- !ruby/object:DateTime '2023-06-15 09:59:30.558000000 +02:00'\n" } | ||
|
||
context "#load_yaml" 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.
Can we have tests that verify a few different scenarios - Time
, DateTime
, BigDecimal
? I also wonder if we should have a test that uses the build_last_value_tracker(plugin)
to do read
and write
these values too
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.
Yep, however I think that testing build_last_value_tracker
is a little bit out of context of this PR. We can avoid to push 2 PRs, one for JRuby 9.4 updates and another to cover with test existing code, and commit everything to this
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.
I'm ok with that
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.
tracker.write | ||
|
||
temp_file.rewind | ||
v = ValueTracking.load_yaml(::File.read(temp_file.path)) |
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.
Can we use tracker.read
here? (Or create a separate reader tracker, and use reader_tracker.read
?)
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 tracker
doesn't have read
method just write
.
The read
methods are present only in FileHandler, which is not exposed externally of the tracker. That's why I've used such code to read back the value.
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.
LGTM
Release notes
Fix: adaptations for JRuby 9.4
What does this PR do?
This PR laid down adaptations to run this plugin under JRuby 9.4 (Ruby 3.1)
List of changes:
load
fromunsafe_load
tosafe_load
reference. Created a wrapper method to behave consistently across different versions of JRuby.Why is it important/What is the impact to the user?
Let the user to use this plugin also on future Logstash versions which ship JRuby >= 9.4
Checklist
[ ] I have commented my code, particularly in hard-to-understand areas[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files (and/or docker env variables)[ ] I have added tests that prove my fix is effective or that my feature worksAuthor's Checklist
How to test this PR locally
Related issues