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
Switched time string comparation to Timestamp comparable to avoiding problems due to precision loss #141
Switched time string comparation to Timestamp comparable to avoiding problems due to precision loss #141
Conversation
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 ❇️
spec/filters/date_spec.rb
Outdated
end | ||
end | ||
|
||
RSpec::Matchers.define :be_a_logstash_timestamp_equivalent_to do |expected| |
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.
we've now added this matcher to two plugins, and should probably consider adding it to our shared devutils spec helper.
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.
HI @yaauie thanks for pointing it out, I've created issue elastic/logstash-devutils#98 to track it.
I've aligned to master
and bumped the version of this plugins to be published, so I ask you a quick second review
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.
Updated the dependency to devutils >= 2.3
to reuse the be_a_logstash_timestamp_equivalent_to
matcher
1f35eba
to
a90d6f3
Compare
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.
Actual changes LGTM.
I don't think we need to bump the version, and we could improve the changelog to be more use-centric.
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 🌮
Thank you for getting those shared assertions upstream into devutils!
@@ -24,7 +24,7 @@ Gem::Specification.new do |s| | |||
s.add_development_dependency 'logstash-input-generator' | |||
s.add_development_dependency 'logstash-codec-json' | |||
s.add_development_dependency 'logstash-output-null' | |||
s.add_development_dependency 'logstash-devutils' | |||
s.add_development_dependency 'logstash-devutils', '>= 2.3' |
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.
🎉
Release notes
Fix spec and unit tests after introduction of nanosecond precision in Logstash with elastic/logstash#12797
What does this PR do?
This PR switched time comparations in specs and unit test from String to
org.logstash.Timestamp
to avoid problems due to loss of precision.The PR elastic/logstash#12797 introduced nanosecond precision into Logstash, a similar problem happened also into JDBC plugin and here is implemented the same solution described in the original comment.
Why is it important/What is the impact to the user?
It doesn't impact the user, it's only related to tests
Checklist
I have commented my code, particularly in hard-to-understand areasI have made corresponding changes to the documentationI 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
./gradlew test
on a JDK 11Related issues
Use cases
Screenshots
The problem could be seen at https://app.travis-ci.com/github/logstash-plugins/logstash-filter-date/jobs/545405353#L528
Logs